You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varLab=require('lab');Lab.experiment('calculator',function(){Lab.before(function(done){console.log('called: before');done();});Lab.beforeEach(function(done){console.log('called: beforeEach');done();});Lab.afterEach(function(done){console.log('called: afterEach');done();});Lab.after(function(done){console.log('called: after');done();});Lab.test('returns true when zero',function(done){console.log('called: test');Lab.expect(0).to.equal(0);done();});Lab.experiment('addition',function(){Lab.test('returns true when 1 + 1 equals 2',function(done){console.log('called: test');Lab.expect(1+1).to.equal(2);done();});});Lab.experiment('subtract',function(){Lab.test('returns true when 1 - 1 equals 0',function(done){console.log('called: test');Lab.expect(1-1).to.equal(0);done();});});});
Run with tap (lab examples/nested_experiments.js -r tap) and you get the following output:
1..3
called: before
called: beforeEach
called: test
ok 1 calculator returns true when zero
called: afterEach
called: after
called: test
ok 2 calculator addition returns true when 1 + 1 equals 2
called: test
ok 3 calculator subtract returns true when 1 - 1 equals 0
# tests 3
# pass 3
# fail 0
expected output should be:
1..3
called: before
called: beforeEach
called: test
ok 1 calculator returns true when zero
called: afterEach
called: beforeEach
called: test
ok 2 calculator addition returns true when 1 + 1 equals 2
called: afterEach
called: beforeEach
called: test
ok 3 calculator subtract returns true when 1 - 1 equals 0
called: afterEach
called: after
# tests 3
# pass 3
# fail 0
Note: I've used tap for the simplistic output - its not a symptom of that formatter, more so structure of the experiments built in index.js.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
lockbot
locked as resolved and limited conversation to collaborators
Jan 9, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Consider the following test:
Run with tap (
lab examples/nested_experiments.js -r tap
) and you get the following output:expected output should be:
Note: I've used tap for the simplistic output - its not a symptom of that formatter, more so structure of the experiments built in index.js.
The text was updated successfully, but these errors were encountered: