Skip to content

Commit

Permalink
fix: force exit when runner complete (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore authored and atian25 committed Oct 10, 2017
1 parent a7c4b53 commit 7386194
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/cmd/test.js
Expand Up @@ -59,6 +59,8 @@ class TestCommand extends Command {
/* istanbul ignore next */
testArgv.timeout = testArgv.timeout || process.env.TEST_TIMEOUT || 60000;
testArgv.reporter = testArgv.reporter || process.env.TEST_REPORTER;
// force exit
testArgv.exit = true;

if (debug) {
// --no-timeouts
Expand Down
16 changes: 16 additions & 0 deletions test/fixtures/no-exit/test/foo.test.js
@@ -0,0 +1,16 @@
'use strict';

const http = require('http');
const assert = require('assert');

describe('mocha-test', () => {
it('should work', () => {
assert(true);
});
});

const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('okay');
});
server.listen();
8 changes: 8 additions & 0 deletions test/lib/cmd/test.test.js
Expand Up @@ -110,6 +110,14 @@ describe('test/lib/cmd/test.test.js', () => {
.end();
});

it('should force exit', () => {
const cwd = path.join(__dirname, '../../fixtures/no-exit');
return coffee.fork(eggBin, [ 'test' ], { cwd })
.debug()
.expect('code', 0)
.end();
});

describe('simplify mocha error stack', () => {
const cwd = path.join(__dirname, '../../fixtures/test-files-stack');

Expand Down

0 comments on commit 7386194

Please sign in to comment.