Created
August 6, 2020 17:59
-
-
Save nadvolod/dee5c5029d3316c6bace2ad97cf88e81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert'); | |
let failureCount = 0; | |
before(function () { | |
console.log('before()', failureCount) | |
}); | |
beforeEach(function () { | |
console.log('beforeEach()', failureCount) | |
}); | |
after(function () { | |
console.log('after()', failureCount) | |
}); | |
afterEach(function () { | |
console.log('afterEach()', failureCount) | |
}); | |
describe('Test 1', () => { | |
it('should fail', () => { | |
failureCount++ | |
console.log('Test 1', failureCount) | |
assert.equal(false, true); | |
}); | |
}); | |
describe('Test 2', () => { | |
beforeEach(() => { | |
console.log('beforeEach()', failureCount) | |
failureCount = 0 | |
}); | |
it('should pass', () => { | |
assert.equal(false, false); | |
}); | |
}); | |
describe('Test 3', () => { | |
it('should equal 0', () => { | |
assert.equal(failureCount, 0); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SL-0369:mocha-test nikolayadvolodkin$ ./node_modules/mocha/bin/mocha | |
before() 0 | |
Test 1 | |
beforeEach() 0 | |
Test 1 1 | |
1) should fail | |
afterEach() 1 | |
Test 2 | |
beforeEach() 1 | |
beforeEach() 1 | |
✓ should pass | |
afterEach() 0 | |
Test 3 | |
beforeEach() 0 | |
✓ should equal 0 | |
afterEach() 0 | |
after() 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment