You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
require.resolve is not a function when using jest.mock #692
Not sure if it's related, but I'm seeing similar behavior with enzyme. I have a jest.config.js file that works fine locally but seems to be ignored in the sandbox. When I inline the jest config into the package.json it still doesn't load the setupTestFrameworkScriptFile or setupFiles files. So I then tried to add the enzyme configuration code at the top of my test files and got more errors. Here's the URL to the import of my repo https://codesandbox.io/s/github/the0neWhoKnocks/app-console/tree/master/
I didn't find anything regarding enzyme in the issues, but after reading that you have to build support for frameworks, maybe enzyme also needs to be added to the pile.
jest.useFakeTimers() doesn't work either.
In the meantime, is there a way to disable tests in the sandbox?
@FDiskas yeah I tried that, but that's not a solution when jest has setupTestFrameworkScriptFile built in. Also, even after doing that, a lot of tests didn't work due to the usage of mock and useFakeTimers. It'd be nice if in the meantime, codesandbox would display a message saying "sorry, these testing features aren't available" or "these tests have been disabled due to lack of api support". Something along those lines so consumers don't waist time debugging their code. Honestly I'd be fine with the ability to just toggle tests off, I saw there was a way to toggle watching of files off, but the tests would still run at least once throwing inaccurate errors.
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.
Activity
CompuIves commentedon Apr 4, 2018
Ahh, yes good one. We need to build
jest.mocksupport since we use our own resolver and executor for modules.I will try to build this this week, regardless I'll keep this issue open for everyone to pickup in the meantime.
We need to get all
jest.mockcalls and add them to thealiasesfield onManager. I think that should do the trick and makejest.mockwork.FDiskas commentedon Apr 5, 2018
jest.spyOn is another one :)
the0neWhoKnocks commentedon May 18, 2018
Not sure if it's related, but I'm seeing similar behavior with enzyme. I have a
jest.config.jsfile that works fine locally but seems to be ignored in the sandbox. When I inline the jest config into thepackage.jsonit still doesn't load thesetupTestFrameworkScriptFileorsetupFilesfiles. So I then tried to add the enzyme configuration code at the top of my test files and got more errors. Here's the URL to the import of my repo https://codesandbox.io/s/github/the0neWhoKnocks/app-console/tree/master/I didn't find anything regarding enzyme in the issues, but after reading that you have to build support for frameworks, maybe enzyme also needs to be added to the pile.
jest.useFakeTimers()doesn't work either.In the meantime, is there a way to disable tests in the sandbox?
FDiskas commentedon May 21, 2018
Did you tried to install https://www.npmjs.com/package/enzyme-adapter-react-16 and https://www.npmjs.com/package/enzyme
?:goat:
It works if you add all configuration to each test file
https://codesandbox.io/s/vm6xrzp0y7
the0neWhoKnocks commentedon May 21, 2018
@FDiskas yeah I tried that, but that's not a solution when jest has
setupTestFrameworkScriptFilebuilt in. Also, even after doing that, a lot of tests didn't work due to the usage of mock and useFakeTimers. It'd be nice if in the meantime, codesandbox would display a message saying "sorry, these testing features aren't available" or "these tests have been disabled due to lack of api support". Something along those lines so consumers don't waist time debugging their code. Honestly I'd be fine with the ability to just toggle tests off, I saw there was a way to toggle watching of files off, but the tests would still run at least once throwing inaccurate errors.FDiskas commentedon May 21, 2018
@the0neWhoKnocks so lets wait for #513
github-actions commentedon Sep 4, 2020
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.
github-actions commentedon Oct 1, 2020
This issue has been automatically closed because there wasn't any activity after the previous notice or the stale label wasn't removed.