Closed karmeleon closed 2 months ago
This is interesting, but I wasn't able to reproduce the issue on my Mac. A couple of things stand out from your screenshots:
Would you be able to provide a minimal repository that we could use to reproduce and further diagnose the issue?
- In your screenshots, each loop has a different color bar. I don't see that behavior in my repository. Are you using any additional coverage-related plugins or specific settings?
Nope, just VSC's bracket pair colorization feature and this extension :)
- The statement number gutter isn't highlighted in your snapshots, whereas it is highlighted in mine, as documented by VS Code:
Right, VSC doesn't have gutter highlighting either. The native coverage stuff actually did work once or twice, but when I came back to my editor after the holiday weekend it didn't work anymore.
I'm not able to provide a sample repo right now -- lots of proprietary stuff to strip out and I'm really just messing with this extension at this point, but is there some way I could use debug mode and the VSC dev tools to intercept calls to the API and see if something's not working as expected?
Thanks for taking a look!
Aha, I actually see a stacktrace in the VSC debugger when this fails to work:
[Extension Host] JestFileCoverage getDetailed failed for /path/to/the/source/file/being/viewed.tsx: Error: Invalid arguments
at new $ (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:152:6717)
at r (/nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:463810)
at /nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:464103
at Array.forEach (<anonymous>)
at /nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:464066
at Array.forEach (<anonymous>)
at a.loadDetails (/nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:464035)
at t.JestTestCoverageProvider.<anonymous> (/nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:465110)
at Generator.next (<anonymous>)
at /nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:463028
at new Promise (<anonymous>)
at r (/nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:462773)
at t.JestTestCoverageProvider.loadDetailedCoverage (/nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:464942)
at t.JestTestProvider.<anonymous> (/nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:484204)
at Generator.next (<anonymous>)
at /nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:483119
at new Promise (<anonymous>)
at r (/nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:482864)
at W.loadDetailedCoverage (/nail/home/shawn/.vscode-server/extensions/orta.vscode-jest-6.3.0/out/extension.js:2:484141)
at b.getCoverageDetails (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:156:24477)
at v.getCoverageDetails (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:156:27280)
at E.$getCoverageDetails (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:156:20185)
at y.S (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:151:5980)
at y.Q (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:151:5746)
at y.M (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:151:4739)
at y.L (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:151:3830)
at i.value (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:151:2297)
at n.B (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:83:737)
at n.fire (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:83:954)
at s.fire (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:97:14453)
at i.value (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:177:8655)
at n.B (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:83:737)
at n.fire (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:83:954)
at s.fire (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:97:14453)
at d.A (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:97:17612)
at i.value (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:97:15970)
at n.B (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:83:737)
at n.fire (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:83:954)
at m.acceptChunk (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:97:12199)
at /nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:97:11469
at Socket.v (/nail/home/shawn/.vscode-server/cli/servers/Stable-fee1edb8d6d72a0ddff41e5f71a671c23ed924b9/server/out/vs/workbench/api/node/extensionHostProcess.js:174:14266)
at Socket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Socket.Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)
I believe that maps to this line in the source.
EDIT: I can see coverage if I use coverageProvider: 'v8'
in my Jest config file, but for my setup only babel
provides accurate coverage data.
Upon further investigation, it appears that some files have working coverage, mostly the simple ones. Here's an example file that fails to render coverage, even though it's simple:
export default function getPaddingClass(side: string, units?: string | number | null): string {
if (!units) {
return '';
}
const unitsLabel = units === 'half' ? '-half' : String(units);
const sideLabel = side[0];
return `u-padding-${sideLabel}${unitsLabel}`;
}
I do see that the Babel JSON has an empty-ish block that V8 doesn't, maybe that's the culprit?
"type": "if",
"locations": [
{
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 4,
"column": 5
}
},
{
"start": {},
"end": {}
}
],
"line": 2
@karmeleon, this is tremendously helpful, thanks. I will take a closer look later today.
@karmeleon, I think I found the issue. Before I release the fix, could you verify it with the attached vsix file? Thanks. vscode-jest-6.3.1.vsix.zip
Confirmed, works perfectly both in the above file as well as a few other spot checked files across the repo. Thanks so much for the quick fix!
Describe the bug Using the prerelease extension version (v6.3.0), I can use
vscode-jest
to run all the tests in a suite, and view the test coverage panel in the Testing view. This data is correct, but when I click on a file with incomplete coverage, VSCode's inline coverage feature doesn't display any coverage info despite clicking on "Show Inline Coverage" in the coverage toolbar.To Reproduce Steps to reproduce the behavior:
Note: A sample repo will help us identify the bug much faster. 🙏
Expected behavior VSCode's built-in coverage API highlights lines that lack coverage.
Screenshots Not much to look at, but line 114 is lacking coverage here.
Environment (please complete the following information):
node -v
: v20.10.0npm -v
oryarn --version
: yarn v4.2.1Prerequisite
jest
cliAdditional context Add any other context about the problem here.
If I revert back to the release version of the extension (v6.2.5),
vscode-jest
's homebrew coverage report works correctly with otherwise identical setup:The fastest (and the most fun) way to resolve the issue is to submit a pull request yourself. If you are interested, please check out the contribution guide, we look forward to seeing your PR...