Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Using function as module factory in jest.mock causes test loading fail #44

Closed
zzzorgo opened this issue Apr 26, 2020 · 1 comment · Fixed by #68
Closed

Using function as module factory in jest.mock causes test loading fail #44

zzzorgo opened this issue Apr 26, 2020 · 1 comment · Fixed by #68
Labels
issue with dependency It is likely that a dependency is causing the issue being experienced.

Comments

@zzzorgo
Copy link

zzzorgo commented Apr 26, 2020

If you use function instead of object as module factory in jest.mock call your test will not load. Jest documentation doesn't tell anything about validity of this syntax but nevertheless jest runner works with it https://jestjs.io/docs/en/jest-object#jestmockmodulename-factory-options.

Minimal repository: https://github.com/zzzorgo/vscode-jest-test-adapter-issue
There is repo with two issues i was just too lazy to create separate repos, look for jestMockWithFunction.test.js file

@rossknudsen
Copy link

For completeness - this seems to be an issue in the parser in jest-editor-support. There is an open PR to update the parser (jest-community/jest-editor-support#30) which may fix this.

@rossknudsen rossknudsen added the issue with dependency It is likely that a dependency is causing the issue being experienced. label Apr 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue with dependency It is likely that a dependency is causing the issue being experienced.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants