|
@@ -1,33 +1,31 @@
|
|
|
|
|
|
import child_process from 'child_process';
|
|
|
-import tape from 'blue-tape';
|
|
|
+import tape from 'tape';
|
|
|
+import _test from 'tape-promise';
|
|
|
import http from 'http';
|
|
|
import socketclient from 'socket.io-client';
|
|
|
|
|
|
+const tapetest = _test(tape);
|
|
|
|
|
|
const serverhost = 'localhost',
|
|
|
serverport = 2424,
|
|
|
server = child_process.fork('build/server.js');
|
|
|
|
|
|
-tape.test('test server', function testServer(t) {
|
|
|
+tapetest('test server', async function testServer(t) {
|
|
|
let client;
|
|
|
|
|
|
- waitPro()
|
|
|
- .then(function done(a) {
|
|
|
- return requestPro(`http://${serverhost}:${serverport}`)
|
|
|
- .then(function done(a) {
|
|
|
- t.equal(a, 'yes', 'received message from server');
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
- .catch(function catchall(e) {
|
|
|
+ try {
|
|
|
+ await waitPro();
|
|
|
+ const data = await requestPro(`http://${serverhost}:${serverport}`);
|
|
|
+ t.equal(data, 'working', 'received message from server');
|
|
|
+ }
|
|
|
+ catch(e) {
|
|
|
console.log('error somewhere', e);
|
|
|
t.fail('error somewhere');
|
|
|
- })
|
|
|
- .then(function done(a) {
|
|
|
- t.end();
|
|
|
- server.kill();
|
|
|
- })
|
|
|
+ }
|
|
|
+
|
|
|
+ t.end();
|
|
|
+ server.kill();
|
|
|
});
|
|
|
|
|
|
|