Skip to content

Instantly share code, notes, and snippets.

@colwem
Last active March 11, 2016 03:58
Show Gist options
  • Select an option

  • Save colwem/84d04c2f9ccbca8626c8 to your computer and use it in GitHub Desktop.

Select an option

Save colwem/84d04c2f9ccbca8626c8 to your computer and use it in GitHub Desktop.
'use strict';
const expect = require('chai').expect;
describe('foo', () => {
it('should finish', (done) => {
Promise
.reject(new Error())
.catch(() => expect(false).to.be.true)
.then(() => done(), done);
});
it("should finish but won't", (done) => {
Promise.resolve(true)
.then(() => {expect(false).to.be.true; done()}, done);
});
it("should be rejected but isn't", (done) => {
Promise.resolve(true)
.then(() => {expect(false).to.be.true; done()})
.catch(() => done());
});
it("Wooooo this works", (done) => {
Promise.resolve(true)
.then(() => {expect(false).to.be.true; done()})
.catch(done);
});
});
foo
1) should finish
2) should finish but won't
✓ should be rejected but isn't
3) Wooooo this works
1 passing (2s)
3 failing
1) foo should finish:
AssertionError: expected false to be true
at /Users/colwem/workshop/autocron/test/temp.test.js:9:36
at runMicrotasksCallback (node.js:337:7)
at doNTCallback0 (node.js:430:9)
at process._tickCallback (node.js:359:13)
2) foo should finish but won't:
Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
at null.<anonymous> (/usr/local/lib/node_modules/mocha/lib/runnable.js:170:19)
at Timer.listOnTimeout (timers.js:92:15)
3) foo Wooooo this works:
AssertionError: expected false to be true
at /Users/colwem/workshop/autocron/test/temp.test.js:26:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment