Skip to content

Instantly share code, notes, and snippets.

@why-jay
Created June 26, 2015 04:06
Show Gist options
  • Save why-jay/aefc5405f27e20b08ebc to your computer and use it in GitHub Desktop.
Save why-jay/aefc5405f27e20b08ebc to your computer and use it in GitHub Desktop.
Why does foo-test fail?
Using Jest CLI v0.4.13
FAIL __tests__/foo-test.js (0.896s)
● foo() › it should throw
- Expected function to throw an exception.
// __tests__/foo-test.js
import foo from '../src/foo.js';
describe('foo()', () => {
it('should throw', () => {
expect(() => {
foo();
}).toThrow();
});
});
// src/foo.js
export default function foo() {
throw new Error();
}
{
"devDependencies": {
"babel-jest": "*",
"jest-cli": "*"
},
"scripts": {
"test": "jest"
},
"jest": {
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"testFileExtensions": ["es6", "js"],
"moduleFileExtensions": ["js", "json", "es6"],
"unmockedModulePathPatterns": ["lodash"]
}
}
node v0.12.2
npm v2.11.2
babel-jest v5.3.0
jest-cli v0.4.13
@why-jay
Copy link
Author

why-jay commented Jun 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment