Skip to content

Commit

Permalink
ff
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Apr 4, 2019
1 parent 5cbe42e commit 4322492
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/cmd/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ class TestCommand extends Command {

// whether is debug mode, if pass --inspect then `debugOptions` is valid
// others like WebStorm 2019 will pass NODE_OPTIONS, and egg-bin itself will be debug, so could detect `process.env.JB_DEBUG_FILE`.

if (debugOptions || process.env.JB_DEBUG_FILE) {
// --no-timeouts
testArgv.timeouts = false;
testArgv.timeout = undefined;
// --no-timeout
testArgv.timeout = false;
}

// collect require
Expand Down
5 changes: 4 additions & 1 deletion test/lib/cmd/test.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,18 @@ describe('test/lib/cmd/test.test.js', () => {

describe('no-timeouts', () => {
it('should timeout', done => {
mm(process.env, 'TEST_TIMEOUT', '5000');
mm(process.env, 'TESTS', 'test/**/no-timeouts.test.js');
coffee.fork(eggBin, [ 'test' ], { cwd })
.expect('stdout', /timeout: 60000/)
.expect('stdout', /timeout: 5000/)
.expect('code', 0)
.end(done);
});

it('should no-timeout at debug mode', done => {
mm(process.env, 'TESTS', 'test/**/no-timeouts.test.js');
coffee.fork(eggBin, [ 'test', '--inspect' ], { cwd })
// .debug()
.expect('stdout', /timeout: 0/)
.expect('code', 0)
.end(done);
Expand All @@ -253,6 +255,7 @@ describe('test/lib/cmd/test.test.js', () => {
mm(process.env, 'TESTS', 'test/**/no-timeouts.test.js');
mm(process.env, 'JB_DEBUG_FILE', __filename);
coffee.fork(eggBin, [ 'test' ], { cwd })
// .debug()
.expect('stdout', /timeout: 0/)
.expect('code', 0)
.end(done);
Expand Down

0 comments on commit 4322492

Please sign in to comment.