Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest 28 support #17

Open
kamil-cf opened this issue Jun 10, 2022 · 3 comments
Open

Jest 28 support #17

kamil-cf opened this issue Jun 10, 2022 · 3 comments

Comments

@kamil-cf
Copy link

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: extension@7.0.0
npm ERR! Found: jest@28.1.0
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 jest-chrome@0.7.2
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?

@sghsri
Copy link

sghsri commented Jul 6, 2022

@kamil-cf were you able to figure this out / get this working?

@kamil-cf
Copy link
Author

kamil-cf commented Jul 7, 2022

No, we don't use jest-chrome, but our internal mocks only for now.

@mag
Copy link

mag commented Nov 17, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants