Created
September 23, 2015 10:18
-
-
Save dinhoabreu/7c90b405a58584235a2c to your computer and use it in GitHub Desktop.
Mocha behavior
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
describe('Behavior mocha', function () { | |
before(function () { | |
console.log('++++> before'); | |
}); | |
after(function () { | |
console.log('++++> after'); | |
}); | |
beforeEach(function () { | |
console.log('- - > before each'); | |
}); | |
afterEach(function () { | |
console.log('- - > after each'); | |
}); | |
describe('Behavior Group 1', function () { | |
before(function () { | |
console.log('++++> before group 1'); | |
}); | |
after(function () { | |
console.log('++++> after group 1'); | |
}); | |
beforeEach(function () { | |
console.log('- - > before each group 1'); | |
}); | |
afterEach(function () { | |
console.log('- - > after each group 1'); | |
}); | |
it('it(1.1)', function (done) { | |
delayedMessage('it(1.1)', 100, done); | |
}); | |
it('it(1.2)', function (done) { | |
delayedMessage('it(1.2)', 50, done); | |
}); | |
it('it(1.3)', function (done) { | |
delayedMessage('it(1.3)', 10, done); | |
}); | |
}); | |
it('it(1)', function (done) { | |
delayedMessage('it(1)', 100, done); | |
}); | |
it('it(2)', function (done) { | |
delayedMessage('it(2)', 50, done); | |
}); | |
it('it(3)', function (done) { | |
delayedMessage('it(3)', 10, done); | |
}); | |
}); | |
function delayedMessage(msg, delay, done) { | |
console.log('----> ' + msg + ': start'); | |
setTimeout(function () { | |
console.log(' ' + msg + ': end'); | |
done(); | |
}, delay); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment