Skip to content

Commit

Permalink
Speed up babelmark app tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Nov 19, 2020
1 parent 1910a3c commit 97a9d46
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions test/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ env:
node: true
mocha: true
es6: true

parserOptions:
ecmaVersion: 2017
23 changes: 16 additions & 7 deletions test/babelmark-responder.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
'use strict';


describe.skip('babelmark responder app', function () {
describe('babelmark responder app', function () {
var app;

var PORT = 5005;
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(
'node',
[ '../support/babelmark-responder.js' ],
Expand All @@ -18,20 +21,26 @@ describe.skip('babelmark responder app', function () {
}
);

// Wait a bit until app bind port
setTimeout(done, 1000);
// Wait until app bind port
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
.get('/')
.expect(200)
.expect(/<!DOCTYPE html>/i);
});


it('do request', function () {
it('do request', () => {
return request
.get('/?text=foo')
.expect(200)
Expand All @@ -43,7 +52,7 @@ describe.skip('babelmark responder app', function () {
});


after(function () {
after(() => {
if (app) app.kill();
});
});

0 comments on commit 97a9d46

Please sign in to comment.