jest-expect-message
jest-expect-message copied to clipboard
How to configure with existing setupTests.js
This is probably just a documentation issue. I am on Jest 23, and I already have
"jest": {
"setupTestFrameworkScriptFile": "<rootDir>src/react/setupTests.js"
Can I somehow initialize jest-expect-message
within my setupTests.js
file?
Leaving comment here to help future travellers.
TL;DR:
Add import 'jest-expect-message';
to your setupTests.ts
file.
Long version:
I rolled a fresh create-react-app
with TypeScript app, which of course came with the setupTests.ts
file. Note the file extension .ts
. I installed this jest-expect-message
dep together with @types/jest-expect-message
. I added the above-mentioned import statement. Voila! It just works.
Though this is for .ts
, I expect it to also just work with .js
. Of course with JS you won't have to bother with installing the @types
dep.
Hope this helps others.
@saifulss Thank you very much!
I've added this advice to the projects readme so will go ahead and close this. Thanks!