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

-M, --context-timeout is ignored; test passed even it is not triggered #729

jagin opened this issue Jul 28, 2017 · 1 comment


Copy link

@jagin jagin commented Jul 28, 2017


I have the following test:

const Code = require('code')
const Lab = require('lab')
const lab = exports.lab = Lab.script()

const describe = lab.describe
const it =
const before = lab.before
const expect = Code.expect

before(done => {
 setTimeout(() => {
   console.log('## before ##')
 }, 3000)

describe('TEST', () => {
 it('test it', done => {
   console.log('## test ##')


I run it with lab and result is as follow:

  √ 6) test it (0 ms)                                                                                              
Test script errors:                                                                                                
Timed out (2000ms) - Before                                                                                        
      at Timeout.setTimeout (c:\Users\Jarek\Projects\test\node_modules\lab\lib\runner.js:582:23)     
      at ontimeout (timers.js:365:14)                                                                              
      at tryOnTimeout (timers.js:237:5)                                                                            
      at Timer.listOnTimeout (timers.js:207:5)                                                                     
There were 1 test script error(s).                                                                                 
1 tests complete                                                                                                   
Test duration: 2009 ms                                                                                             
No global variable leaks detected                                                                                  
  1. I got timeout on before even the -M is not set and the documentation says:

-M, --context-timeout - default timeouts for before, after, beforeEach and afterEach in milliseconds. Disabled by default.

  1. Even we got timeout on before the report shows us that the test passed (it is green) but no console.log was executed

Running the test with lab -M 5000 it works perfectly:

## before ##
## test ##       
  √ 6) test it (3 ms)              
1 tests complete                   
Test duration: 3014 ms             
No global variable leaks detected  

This comment has been minimized.

Copy link

@geek geek commented Jul 28, 2017

@jagin good catch. This is a bug, the before/after timeout should be disabled by default as indicated by the documentation.

@geek geek added the bug label Jul 28, 2017
@geek geek added this to the 16.0.0 milestone Jul 25, 2018
@geek geek self-assigned this Jul 25, 2018
@geek geek closed this in #844 Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.