Open tostringtheory opened 4 years ago
Just checking in on this, could someone at least point me to whether this is an issue with this extension or the tools it builds upon? As mentioned above I tried to hunt it down but couldn't find it in my initial searches if this was relevant to this repository or the jest IDE integrations repository. I'm happy to create a PR myself in a repo resolving this.
@tostringtheory it does look like it is a problem on our end, a quick investigate led me to believe that the SnapshotCodeLensProvider
didn't pass jest config to the jest-editor-support
that could find snapshot via snapshotResolver
...
We have stopped parsing jest config a while back thinking there is really no need for it. But looks like you just found one use case! Maybe we need to revisit this decision 🤔 ...
@connectdotz - ahh, that's why I was confused. I thought from what I was looking at in the jest-editor-support
package that it should handle it, and didn't see anything specific to vscode-jest
that needed it (looked like it was just consuming jest-editor-support
). Didn't dawn on me that the issue would be not passing configuration. You appear to be correct too, the config looks to be the 3rd argument to the ctor.
I just checked in the SnapshotCodeLensProvider
commit history, and actually don't see that the jest.pathToConfig
was ever even passed to the Snapshot
object.
Would you want me to try and take a crack at a PR for this? I've not done vscode extensions work so I might have some slight environment work to prep, but it looks trivial, unless there's caveat's i'm not aware of (dragons?).
@tostringtheory sorry for the late reply, great spirit 👍 , yes I am open for discussing this fix ... just vaguely remembered that there were quite a few issues surrounding getting config from jest before, but maybe something has changed and it won't hurt to have a fresh perspective to reexamine this again.
Any progress on this? I am facing the very same issue
Having the same issue without a custom snapshotResolver here. Debug mode is not much help, only get errors like this ones:
Environment
node -v
: v12.14.0npm -v
: 6.13.4npm ls jest
ornpm ls react-scripts
(if you haven’t ejected): -- jest@26.0.1in
jest.config.js
:in
scripts/testing/snapshot-resolver.js
:Prerequisite
npm run test
ornode_modules/.bin/jest
) npm run test, which executes:jest
Steps to Reproduce
Open repository: https://github.com/tostringtheory/vscode-jest-snapshot-bug Run yarn install | npm install
If you run yarn test / npm run test, then the test succeeds, and does not fail to resolve the snapshot. However, while the vscode-jest extension sees the test was successful, it still reports that the snapshot is missing:
Relevant Debug Info
Enabled the "jest.debugMode", yet there were no errors/issues. I tried to determine which repository would be the owner, but couldn't exactly see where the issue would lie. I see that the jest-community/jest-editor-support seems to reference the necessary property (snapshotResolver) in the project config. However, the vscode extension doesn't appear that it even looks for snapshots (at least when I searched the repository), so I'm not even sure that the issue belongs here. Instead of spinning my wheels hunting, I figured I'd put in an issue and see if someone with more experience/knowledge on this structure could identify the culprit.
Expected Behavior
The same functionality with default snapshot resolution in vscode-jest works with a custom snapshot-resolver. IE, the snapshot would not indicate that it is missing, and CodeLens would be able to peek to the definition.
Actual Behavior
The method call is decorated with a "snapshot missing" statement, even though the test is succeeding.