For me, using the Jest configuration file worked much better because it is the Javascript file itself, so it gives complete freedom:
After running jest --init in your folder, in the jest.config.js file that Jest does, scroll down to find:
// A set of global variables that need to be available in all test environments // globals: {},
Uncomment the second line and put all your globals there.
aarman
source share