Skip to content

Commit

Permalink
Disable dep timeout, which is doc default
Browse files Browse the repository at this point in the history
  • Loading branch information
geek committed Jul 25, 2018
1 parent 4d3e504 commit 4f342e2
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ internals.options = function () {
silence: false,
'silent-skips': false,
sourcemaps: false,
'context-timeout': 0,
timeout: 2000,
verbose: false
};
Expand Down
17 changes: 17 additions & 0 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,23 @@ describe('CLI', () => {
expect(result.output).to.contain('\u001b[');
});

it('defaults to no context-timeout for before functions', { timeout: 3400 }, async () => {

const result = await RunCli(['test/cli_timeout/before.js']);

expect(result.errorOutput).to.equal('');
expect(result.code).to.equal(0);
expect(result.output).to.contain('##before##');
});

it('can specify context-timeout for before functions', async () => {

const result = await RunCli(['test/cli_timeout/before.js', '--context-timeout', '500']);

expect(result.code).to.equal(1);
expect(result.output).to.not.contain('##before##');
});

it('can include all files for coverage with the --coverage-path argument', async () => {

const result = await RunCli(['test/cli_coverage', '-t', '100', '--coverage-path', 'test/cli_coverage/include', '-a', 'code']);
Expand Down
41 changes: 41 additions & 0 deletions test/cli_timeout/before.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict';

// Load modules

const Code = require('code');
const _Lab = require('../../test_runner');


// Declare internals

const internals = {};


// Test shortcuts

const lab = exports.lab = _Lab.script();
const before = lab.before;
const describe = lab.describe;
const it = lab.it;
const expect = Code.expect;

before(() => {

return new Promise((resolve) => {

setTimeout(() => {

console.log('##before##');
resolve();
}, 3000)
});
});

describe('test before timeout', () => {

it('test', () => {

console.log('##test##');
expect(1).to.equal(1);
});
});

0 comments on commit 4f342e2

Please sign in to comment.