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
When creating nested mocks with module/folder/file it will fail on Windows due to separation character.
For example, creating file
/__mocks__/lodash/fp/add.js
^^^^folder
to mock lodash/fp/add will fail on Windows.
But using file
/__mocks__/lodash/sum.js
^^^^^no folder
to mock lodash/sum would just work fine.
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.
It should mock lodash/fp/add with /__mocks__/lodash/fp/add.js on Windows.
I've tried to modify this line in get_mock_name.js, adding .replace(/\\/g, '/') at the end and this was working. But I'm not sure if this is the best solution.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
In the repo above with 2 CIs.
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Do you want to request a feature or report a bug?
BUG
related to #2483 ?
What is the current behavior?
When creating nested mocks with
module/folder/file
it will fail on Windows due to separation character.For example, creating file
to mock
lodash/fp/add
will fail on Windows.But using file
to mock
lodash/sum
would just work fine.If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.Check my reproducing repo and its CI status.
What is the expected behavior?
It should mock
lodash/fp/add
with/__mocks__/lodash/fp/add.js
on Windows.I've tried to modify this line in get_mock_name.js, adding
.replace(/\\/g, '/')
at the end and this was working. But I'm not sure if this is the best solution.Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
In the repo above with 2 CIs.
The text was updated successfully, but these errors were encountered: