Skip to content

Instantly share code, notes, and snippets.

@dinhoabreu
Created September 23, 2015 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dinhoabreu/7c90b405a58584235a2c to your computer and use it in GitHub Desktop.
Save dinhoabreu/7c90b405a58584235a2c to your computer and use it in GitHub Desktop.
Mocha behavior
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