Skip to content

Instantly share code, notes, and snippets.

@gustavnikolaj
Created August 10, 2017 12:32
Show Gist options
  • Save gustavnikolaj/7f586b00d5abff1e2abbf5bc4ac87ae7 to your computer and use it in GitHub Desktop.
Save gustavnikolaj/7f586b00d5abff1e2abbf5bc4ac87ae7 to your computer and use it in GitHub Desktop.
WTF Jest
var origExpect = global.expect;
global.expect = function (subject) {
if (arguments.length > 1) {
throw new Error('You passed more than one argument to jest expect.');
}
return origExpect(subject);
};
{
"name": "wtf-jest",
"private": true,
"devDependencies": {
"jest": "20.0.4",
"unexpected": "10.33.1"
},
"jest": {
"setupTestFrameworkScriptFile": "./jest-fix"
}
}
// this test will pass with jest expect, as it just silently ignores other
// args. it will fail with the jest-fix file loaded
it('should be unexpected', () => {
expect(true, 'to be false');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment