Created
August 10, 2017 12:32
-
-
Save gustavnikolaj/7f586b00d5abff1e2abbf5bc4ac87ae7 to your computer and use it in GitHub Desktop.
WTF Jest
This file contains hidden or 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
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); | |
}; |
This file contains hidden or 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
{ | |
"name": "wtf-jest", | |
"private": true, | |
"devDependencies": { | |
"jest": "20.0.4", | |
"unexpected": "10.33.1" | |
}, | |
"jest": { | |
"setupTestFrameworkScriptFile": "./jest-fix" | |
} | |
} |
This file contains hidden or 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
// 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