i want test some components , but i dont konw how to config the package file , so when i test it, the terminal always display the error message :ReferenceError: DEV is not defined .
You can add "globals": {"__DEV__": true}" to your config.
@cpojer What about global function like fbq which is Pixel code. It says ReferenceError: fbq is not defined
@codemilli Did you find an answer for this?
use setupFiles
@SimenB How? In the docs it says we need to give a path to a .js file, but if the global functions are loaded through a CDN i don't see how i can do that?
I'm using TypeScript and have declared a global type for those functions but jest isn't picking them up
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Add this code to package.json
{
"jest": {
"globals": {
"__DEV__": true
}
}
}
Most helpful comment
You can add
"globals": {"__DEV__": true}"to your config.