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

Test Explorer does not convert failed test to passing after save #757

Closed
JustinGrote opened this issue Aug 25, 2021 · 6 comments · Fixed by #809
Closed

Test Explorer does not convert failed test to passing after save #757

JustinGrote opened this issue Aug 25, 2021 · 6 comments · Fixed by #809
Labels
external-issue issues caused by external system ( (no fix needed)

Comments

@JustinGrote
Copy link

JustinGrote commented Aug 25, 2021

Issue Type: Bug

Capture

Extension version: 4.1.1
VS Code version: Code - Insiders 1.60.0-insider (44568e5947efa4811419e529e80fb14b7554cf61, 2021-08-23T10:43:01.389Z)
OS version: Windows_NT x64 10.0.22000
Restricted Mode: No

System Info
Item Value
CPUs AMD Ryzen 7 4700U with Radeon Graphics (8 x 1996)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.36GB (3.99GB free)
Process Argv --folder-uri file:///c%3A/Users/JGrote/Projects/vscode-adapter --crash-reporter-id 4453efaa-0821-4555-88e2-3de8bad9109e
Screen Reader no
VM 0%
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
pythonvspyt602:30291494
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30291487
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
pythonvsuse255:30319630
vscod805:30301674
pythonvspyt200:30323110
vsccppwtct:30312693
pythonvssor306:30340298
bridge0708:30335490
pygetstartedt2:30353727
dockerwalkthrucf:30348714
bridge0723:30353136
pythonrunftest32cf:30353182
pythonf5test824:30353183
javagetstartedt:30350119
pythonvspyt187cf:30356035
pydsgst2:30356659

@JustinGrote
Copy link
Author

JustinGrote commented Aug 25, 2021

Potential dupe of #734, unconfirmed
EDIT: Probably not, see below.

@JustinGrote
Copy link
Author

This appears to be because if the code matches the last commit, the test will not be run. May need to force override this behavior in jest for the individual file.

Output Window after saving back to "true"

> Test run finished at 8/24/2021, 5:31:22 PM <

No tests found related to files changed since last commit.

@connectdotz
Copy link
Collaborator

connectdotz commented Aug 25, 2021

I assume you are in watch mode? It's a known issue about how jest watcher worked. You can switch to the interactive mode (see autoRun), which triggers run by editor save, regardless of git status.

@alexamy
Copy link

alexamy commented Sep 9, 2021

TL;DR
Set this editor setting to trigger test run on each save:

"jest.autoRun": { "watch": false, "onSave": "test-src-file", "onStartup": ["all-tests"] }

@jmagaram
Copy link

jmagaram commented Sep 20, 2021

I'm having a similar issue. I see the error like Expected 100, Received 1 but the actual javascript test file expects the number 2. The only way I can fix this is to force the tests to run again by either saving the javascript file or switching to manual mode. In my case I'm using ReScript and the test files are generated automatically so I can't easily open them up and save them. There clearly is a problem here. Even if I set the tests in watch mode nothing changes when new test files are added or I edit my ReScript and an updated test file is generated. At this point I have to use manual mode.

This is from a create-react-app with typescript. I added ReScript. If I run "test": "react-scripts test", in watch mode it works fine. As new test files are created and updated, I see the results in the terminal. But I don't see them in the VS Code native test explorer.

@connectdotz
Copy link
Collaborator

@jmagaram

This is from a create-react-app with typescript. I added ReScript. If I run "test": "react-scripts test", in watch mode it works fine.

If yarn test or npm test works from a terminal, try setting your jest.jestCommandLine to that (append additional -- for npm command). In your use case, I think watch mode is probably better than manual/interactive mode since the test files are generated behind the scene...

If the above did not work, then maybe provide a sample repo so we can further investigate...

@connectdotz connectdotz added the external-issue issues caused by external system ( (no fix needed) label Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-issue issues caused by external system ( (no fix needed)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants