Jest 28 support
We use Jest 28 in our project. When installing jest-chrome, we get the following error:
~> npm i jest-chrome -save-dev --save-exact
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/jest
npm ERR! dev jest@"28.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jest@"^26.0.1 || ^27.0.0" from [email protected]
npm ERR! node_modules/jest-chrome
npm ERR! dev jest-chrome@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
I tried to install with --force and it passed but then there is another issue.
When I added './jest.setup.js' as the last entry in my setupFilesAfterEnv and the jest.setup.js file like that:
const chromeMock = require('jest-chrome');
Object.assign(global, chromeMock);
console.log(chromeMock);
and I run my tests, it logs an empty object instead of Chrome mock:
console.log
{ chrome: {} }
at Object.<anonymous> (jest.setup.js:5:9)
And tests fail. They expect chrome.storage API but it doesn't exist.
Am I doing something wrong or Jest 28 is not supported yet?
@kamil-cf were you able to figure this out / get this working?
No, we don't use jest-chrome, but our internal mocks only for now.
Hey all! I'd love to use this project as well, but we're on jest v29. I can't downgrade to jest v27 just to use this library, unfortunately. Any chance of getting this updated?