Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable dep timeout, which is doc default #844

Merged
merged 1 commit into from Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/cli.js
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
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
@@ -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);
});
});