jest code coverage overlay not showing up in vscode anymore - visual-studio-code

It had previously been working. All I had to do is: Ctrl + Shift + P and run Jest: Toggle Coverage. Sometimes I had to manually trigger the test run for the file I wanted to have a code coverage overlay.
I made sure I'm
viewing a file which had a test and
didn't have full coverage
that the extension has code coverage toggled on:
I let all tests run, restarted vscode, enabled autorun, but it all did not help.
jest#29.3.1

I turned out someone had manually disabled jest.autoRun.watch in .vscode/settings.json which is part of the git repo of our project:
"jest.autoRun": { "watch": false, "onSave": "test-file" },
changing it to
"jest.autoRun": { "watch": true, "onSave": "test-file" },
made the overlay reappear.
Setting autoRun.watch to false in the workspace, overwrites the global and user level settings, and without autoRun.watch, jest does not seem to display the code coverage overlay, even if you run the test onSave. As I didn't find something about this in the documentation, I will probably not be the only one, who runs into this.

Related

VS Code cannot breakpoint or step through 3rd party Python code from Jupyter Notebook

One of my main uses for a debugger is to step through parts of new libraries to better understand how they work and how to use them. But, my current install of VS Code refuses to let me set breakpoints or step through 3rd party libraries when I start debugging in Jupyter Notebook. I get a 'Breakpoint in file excluded by filters' error.
I've looked through everything I could find online about this problem, and nothing I've tried has worked. I have:
In File > Preferences > Settings > Debug turned on 'Allow breakpoints everywhere' for both User and Workspace
In ... Settings > Extensions > Jupyter turned off 'Debug Just My Code' for both
In launch.json changed ' "justMyCode": true ' to ' "justMyCode": false '
After suggestions in How to disable "just my code" setting in VSCode debugger?, I tried to add a separate debug configuration to launch.json. This used to do the trick, but ' "request": "test" ' can no longer be used. Various alternatives I've tried here also do not work (e.g. "request": "attach" or "purpose": "debug-test").
The problem does not exist when I use a python file with the same code. So whatever is applying filters is only doing so when I seek to debug a cell in Jupyter Notebook.
For others, the issue has been resolved, see release notes: "Just My Code" for notebook cell debugging.
"Just My Code" for notebook cell debugging
The "Just My Code" debug feature allows the user to determine whether
the debugger will step through code from Python libraries, or will
only step through user code. This has been enabled by default when
debugging a notebook cell, and you can now set
"jupyter.debugJustMyCode": false to disable it and allow stepping
through library code. For the best experience, upgrade debugpy in
your environment to >=1.6.3. Previously, this setting was only
respected for debugging using the Interactive Window. Now it is
respected in notebook editors as well.
Evidently, the problem I'm encountering is a known bug: https://github.com/microsoft/vscode-jupyter/issues/8146 . I've heard from a VS Code developer that they've (tried) to implement fixes and I should try the latest Insiders vscode build, with the latest pre-release Jupyter extension. I'm not sure I'm ready for bleeding edge, so may live with the bug until these fixes end up in a standard release.

VS Code non-test breakpoints are set to inactive when running Flutter tests

When debugging a Flutter unit or widget test, breakpoints set in the main source (under lib/) are set to inactive and the execution doesn't pause when that line of code is executed. The only way to debug that code is to set a breakpoint in the test being executed and manually step into the main source code. How can I configure VS Code so that I can set a breakpoint anywhere?
This was bugging me for a few weeks before I stumbled across a solution when adding a breakpoint to source code in an external package. VS Code prompted me whether I want to debug just my source code or all code. After selecting "Debug all code" I was suddenly able to hit breakpoints set in my lib folder when running tests.
This setting can be toggled by adding the following lines to settings.json:
"dart.debugExternalPackageLibraries": true,
"dart.debugSdkLibraries": true
https://dartcode.org/releases/v0-14/#debug-just-my-code

Missing dependencies warning React doesn\t show up

I have an issue where the missing dependencies warning doesn't show up any longer for useEffect in React. I am using VS Code if that matters.
Does anyone know what could be the cause for this, as right now I don't even know where to start debugging.
Please install both the Error lens and Microsoft ESLint. It worked for me.
I hope this works for you also.
your problem is related with eslint.
check your code to see is there any line of code like this?
// eslint-disable-next-line
or this:
// eslint-disable-next-line react-hooks/exhaustive-deps
if yes, delete it.
another cause can be the .eslintignore file.
check if there is this .eslintignore file exists on your project, delete it should solve your problem
In VS Code, press Ctrl + Shift + P to bring the command prompt, and run ESLint: Show Output Channel. If ESLint is missing certain React plugins, it will tell you so.
It might also be something wrong with VS Code's TS server. It is the thing that is checking for dependencies, amongst other things. Open the terminal (Ctrl + '), select the Output tab, and on the right hand side select Typescript from the dropdown menu.
If you are using Yarn v3, you need to install eslint and typescript as dev dependencies, then run yarn dlx #yarnpkg/sdks vscode and switch VS Code to the workspace version of Typescript (the prompt for that will show in a popup).
In my case, I am using React Extension Pack where some of included extension was already installed in my Vs Code. Then I uninstalled all included extension, after that again install React Extension Pack, and automatically removed all issues.
You may have disabled the react-hooks/exhaustive-deps eslint rule or extended an eslint ruleset which disables it. Make sure that the follow line is absent in any of the eslint configurations used:
'react-hooks/exhaustive-deps': 'off'
VSCode eslint will not work as expected if one of your .eslintrc configuration rules has a wrong configuration.
For example:
{
...
"rules": {
"react/react-in-jsx-scope": false, // <---- this will turn off the warning
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
},
...
}
and if you change 'false' into 'off' then the error will be shown up
{
...
"rules": {
"react/react-in-jsx-scope": "off", // <---- replace false into off
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
},
...
}

'NPM Scripts' missing in VS Code after update to 1.58.0

The "NPM Scripts" view is missing from Views dropdown in the Explorer in my VS Code after I updated to version 1.58.0 today.
How do I enable that?
I have tried "Reload Window", restarting VSCode altogether and adding "npm.enableScriptExplorer": true to no avail.
P.S. my angular project is not in top-level directory, but it made no difference before this update.
After adding "npm.enableScriptExplorer": true in the configuration file, you must display it because by default it is hidden!
You can unhide it by using the Views menu in the explorer:
way to resolve issue
ref : https://github.com/microsoft/vscode/issues/104591#issuecomment-673959672

'Run code' is not working in Visual Studio Code

When I click 'Run code' on the top right corner, or right click then click 'Run code', or use Ctrl+Alt+N, the integrated terminal does not appear and code could not run.
However, I can open the integrated terminal in vscode under View, and able to run code there using commands.
I believe my setting is correct as following. The problem happens suddenly, regardless of language.
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
"code-runner.runInTerminal": true,
So How do I solve this to enable running code directly?
I had the same problem, and solved it by adding:
"folders": [
{
"path": "."
},
],
to my code-workspace file
I also had the same problem, look how I had solve this problem with the help of my friends (Dipesh and Vinit).
Steps:
Open VS code
On the left bottom-corner click on Manage and go into the settings.
In the search settings type code runner, scroll-down and put tick-mark in 'Run In Terminal'.
After that check by running your code.