How do I connect depending on tests?

12 views
Skip to first unread message

Виктор Логин

unread,
May 11, 2015, 7:32:45 PM5/11/15
to testem...@googlegroups.com

For example, I want to test soket.io. How to connect socket.io-client?

var io = require('socket.io-client');


var socketURL = 'http://127.0.0.1:8080';


var options = {
  transports
: ['websocket'],
 
'force new connection': true
};


describe
("Chat Server",function(){


  it
('echo test', function(done){
   
var client = io.connect(socketURL, options);


    client
.emit('echo', "Hi! I'm Test!!!");
 
});


});

Toby Ho

unread,
May 13, 2015, 10:09:04 AM5/13/15
to Виктор Логин, testem...@googlegroups.com
Looks like you are trying to use socket.io via the commonJS module system. You can use Browserify to achieve that. On the other hand, you can also simply include the sockio client script

<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>

Take a look at one of the getting started guides for how to use it. http://socket.io/get-started/
Toby

--
You received this message because you are subscribed to the Google Groups "Testem Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testem-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages