Browse Source

Speed up babelmark app tests

pull/745/head
Vitaly Puzrin 4 years ago
parent
commit
97a9d4637e
  1. 3
      test/.eslintrc.yml
  2. 23
      test/babelmark-responder.js

3
test/.eslintrc.yml

@ -2,3 +2,6 @@ env:
node: true node: true
mocha: true mocha: true
es6: true es6: true
parserOptions:
ecmaVersion: 2017

23
test/babelmark-responder.js

@ -1,14 +1,17 @@
'use strict'; 'use strict';
describe.skip('babelmark responder app', function () { describe('babelmark responder app', function () {
var app; var app;
var PORT = 5005; var PORT = 5005;
var request = require('supertest')('http://127.0.0.1:' + PORT); var request = require('supertest')('http://127.0.0.1:' + PORT);
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
before(function (done) { before(async () => {
app = require('child_process').execFile( app = require('child_process').execFile(
'node', 'node',
[ '../support/babelmark-responder.js' ], [ '../support/babelmark-responder.js' ],
@ -18,12 +21,18 @@ describe.skip('babelmark responder app', function () {
} }
); );
// Wait a bit until app bind port // Wait until app bind port
setTimeout(done, 1000); for (let i = 0; i < 50; i++) {
try {
await request.get('/').expect(200);
break;
} catch (e) {}
await timeout(100);
}
}); });
it('ping root', function () { it('ping root', () => {
return request return request
.get('/') .get('/')
.expect(200) .expect(200)
@ -31,7 +40,7 @@ describe.skip('babelmark responder app', function () {
}); });
it('do request', function () { it('do request', () => {
return request return request
.get('/?text=foo') .get('/?text=foo')
.expect(200) .expect(200)
@ -43,7 +52,7 @@ describe.skip('babelmark responder app', function () {
}); });
after(function () { after(() => {
if (app) app.kill(); if (app) app.kill();
}); });
}); });

Loading…
Cancel
Save