question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debug codelenes disappear after window loads

See original GitHub issue

I’m using vscode-jest in conjunction with Wallaby.js for my TypeScript application. I used to see the Debug CodeLens above it() tests, but they no longer stay – if I restart or do a reload-window, the Debug decoration will appear momentarily, but then disappear. (This is also true if don’t start Wallaby.)

If I run vscode-jest in debug mode, I can see that it seems to be throwing a parse error, but it doesn’t tell me what the offending file is. Using Jest: Start Runner or using Wallaby I’m able to run jest w/o any issues and can see the test output, so this seems to be specific to invocation for codelens support?

node -v: v10.6.0 npm -v: 6.1.0 npm ls jest – jest@20.0.1 Operating system: Win7

thanks

=============

ERR Unexpected token (1:16): SyntaxError: Unexpected token (1:16) at Parser.pp$5.raise (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:4454:13) at Parser.pp.unexpected (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:1761:8) at Parser.pp.expectContextual (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:1723:39) at Parser.pp$1.parseImport (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:2869:10) at Parser.pp$1.parseStatement (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:1884:49) at Parser.parseStatement (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:5910:22) at Parser.pp$1.parseBlockBody (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:2268:21) at Parser.pp$1.parseTopLevel (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:1778:8) at Parser.parse (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:1673:17) at parse (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\babylon\lib\index.js:7305:37) at Snapshot.exports.getASTfor.file [as _parser] (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\jest-editor-support\build\parsers\babylon_parser.js:29:50) at Snapshot.getMetadata (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\node_modules\jest-editor-support\build\Snapshot.js:108:27) at SnapshotCodeLensProvider.provideCodeLenses (C:\Users\me.vscode\extensions\orta.vscode-jest-2.9.0\out\src\SnapshotCodeLens\SnapshotCodeLensProvider.js:23:26) at c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:733:575 at c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:110:323 at new n.Class.derive._oncancel (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:84:776) at Object.t.asWinJsPromise (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:110:286) at e.provideCodeLenses (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:733:529) at c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:748:337 at e._withAdapter (c:\Users\me\AppData\Local\Programs\Microsoft VS …

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

5reactions
connectdotzcommented, Sep 4, 2018

what is the state of the tests you expect to see the debug codeLense? What are your codeLense related settings?

The default settings for codeLense are:

"jest.enableCodeLens": true,
"jest.debugCodeLens.showWhenTestStateIn": [
    "fail",
    "unknown"
  ]

which means it will only show debug codeLense for the tests are either unknown or fail. Once the tests are run and passed, the codeLense will disappear. If you want the codeLense to appear for tests that passed, you can customize:

"jest.debugCodeLens.showWhenTestStateIn": [
    "fail",
    "unknown",
    "pass"
  ]

possible tests status are:

export enum TestState {
  Fail = 'fail',
  Pass = 'pass',
  Skip = 'skip',
  Unknown = 'unknown',
}
1reaction
tryllecommented, Mar 22, 2021

@connectdotz I get a similar error to @TheSimpleZ. In my case, this is because a few of my tests use the nullish coalescing operator. If I remove these, the Debug/Run codelens links start appearing again.

It still fails with v4.0.0-alpha.4, but at least the Debug codelens appears there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CodeLens not showing references - visual studio
Go to Tools -> Options -> Text Editor -> All Languages -> CodeLens then click the "Enable CodeLens" option if it is not...
Read more >
Code lens disappeared in VS Code after 3 year. How can i get ...
I tried a lot from turning it first on and of, restarting pc, Updating vs code, and Changing editor in unity back and...
Read more >
Diagnose problems after deployment - Visual Studio (Windows)
You can load symbol files from the Modules window or by configuring symbols in Tools > Options > Debugging > Symbols.
Read more >
Language Server Extension Guide - Visual Studio Code
With Language Servers, you can implement autocomplete, error-checking (diagnostics), jump-to-definition, and many other language features supported in VS ...
Read more >
Test Explorer in Visual Studio Code - James Pearson
The old “Run Test” and “Debug Test” codelens actions are also still ... be automatically discovered and loaded into the Test Explorer view....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found