vscode-jest
vscode-jest copied to clipboard
UI not updating after test run
Environment
-
node -v
: [8.9.4] -
npm -v
: [6.1.0] -
npm ls jest
ornpm ls react-scripts
(if you haven’t ejected): [[email protected]] -
your vscode-jest settings if customized:
- jest.pathToJest? [fill]
- jest.pathToConfig? [fill]
- anything else that you think might be relevant? [fill]
-
Operating system: [OSX 10.13.6]
Prerequisite
- are you able to run jest test from command line? [yes]
- how do you run your tests from command line? (for example:
npm run test
ornode_modules/.bin/jest
) [npm run test]
Steps to Reproduce
- set jest.runAllTestsFirst to false
- restart
- go to test file and run jest using Jest: start runner
- go to output in the bottom drawer and select "jest", observe that tests ARE running correctly
- observe that ui of code file is not updated at all (empty green circles indicating tests have not run even though they have)
- originally posted with error from console, but that was being caused by another plugin
Relevant Debug Info
this is happening when I don't have runAllTestsFirst enabled (which is a non-starter for me because of the massive amounts of tests in this monolithic code base), and also when I do have runAllTestsFirst enabled, and then try to debug a test.
Expected Behavior
The UX of the code editor updates, showing filled green circles indicating tests ran. The UX shows an error message on lines where the test fails.
Actual Behavior
The tests can be observed to run in the output drawer, but it does not update in the code editor
The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...
Any update on this? I am seeing the same behavior.
I also have the same issue :
Environment vs-code version : tested with current release and pre-release 3.0.1 node -v: [10.15.0] npm -v: [6.4.1] npm ls jest or npm ls react-scripts (if you haven’t ejected): [[email protected]]
your vscode-jest settings if customized: jest.pathToJest? empty/default jest.pathToConfig? empty/default anything else that you think might be relevant? no
Operating system: [Windows Server 2016 Std]
Prerequisite are you able to run jest test from command line? [yes] how do you run your tests from command line? (for example: npm run test or node_modules/.bin/jest) [npm run test]
Actual Behavior (view attached screenshot) Opening VsCode "runAllTestsFirst" starts: "5 test suites failed" Run "npm run test": all successful (or skipped) No vscode-jest UI elements updated : - side bar still shows test files red - status bar still shows "5 test suites" - test file still shows "red dot" and previous error description
@jeromesubs if you expect vscode-jest
to run npm run test
then you most likely need to tell it via jest.pathToJest
, otherwise, it will run plain jest
.
@trcolgrove you mentioned:
observe that ui of code file is not updated at all (empty green circles indicating tests have not run even though they have)
Some times jest might be lagging behind in between code changes, if you save/touch the test file again to make sure it does trigger jest run (the jest output channel should refresh and display a new test result), does the status circles change?
@jeromesubs there might be some misunderstanding, this extension doesn't read the terminal output as the attached image above seems indicated. Instead, it spawns its own node process to run jest according to jest.pathToJest
setting. Therefore if you want it to execute npm run test
, you will need to set "jest.pathToJest":"npm run test"
in your ".vscode/settings.json". You can see the output of the jest in the "Output" tab by clicking on the "Jest" status on the status-bar.
for people who see the test ran (in the OUTPUT tab) but the test status indicators not being updated accordingly: please try the latest release v3.0.2, which we fixed a bug that could cause the test result not get reflected.
I'm in the same boat, very new to jest and this plugin. The output for Jest(client) on startup springs to life and runs all tests:
PASS client-common/src/licenseUtils/license.test.ts (5.252s)
...
...
Time: 5.405s
Ran all test suites.
Finished running all tests. Starting watch mode.
Then changes to:
No tests found related to files changed since last commit.
From there, on save of the test file the output flickers blank then back to:
No tests found related to files changed since last commit.
If I restart the test runner, then tests run and the ui is updated. I haven't ever committed these changes or the files I'm working on, it's all very new....
Environment
vs-code version
: [1.36.1]
npm ls jest or npm ls react-scripts (if you haven’t ejected):
[[email protected]]
your vscode-jest settings if customized:
jest.pathToJest
? empty/default
jest.pathToConfig
? empty/default
anything else that you think might be relevant
? using ts-jest
jest.config.js
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
Operating system
: [Windows_NT x64 10.0.17134]
Prerequisite
are you able to run jest test from command line
? [yes]
how do you run your tests from command line
? [npm run test] or [node_modules.bin\jest]
I thought I ran into this, but I had two tests with the same name! Look out for that. It's a simple gotcha if you're copying and pasting tests. ;)
@counterbeing Same here. But I guess this is a bug of the extension because for Jest the tests with the same name are different tests. So maybe the extension should use some prefix to differentiate test names? For example something like this ${filePath}-${testLineNumberInFile}-${testName}
.