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.

jest.disabledWorkspaceFolders not working

See original GitHub issue

Environment

  1. node -v: v10.16.2

  2. npm -v: 6.10.3

  3. npm ls jest or npm ls react-scripts (if you haven’t ejected): jest@24.9.0

  4. your vscode-jest settings if customized:

  5. Operating system: Win 10

Prerequisite

  • are you able to run jest test from the command line? yes
  • how do you run your tests from the command line? (for example: npm run test or node_modules/.bin/jest) npm run test

Steps to Reproduce

  1. add "jest.disabledWorkspaceFolders": [ ".history" ], to your settings.
  2. install the VS-Code Extension Local History
  3. Edit some test, so that the history extension will create a copy of the test file(with the path) in the /.history/ folder (of your root).
  4. check if a test file is in that folder
  5. run tests
  6. See that the Test from the history folder will also be run.

Expected Behavior

I expected the test from the .history folder not to be executed, as I put the folder name in the jest.disabledWorkspaceFolders setting.

Actual Behavior

The tests in the folders will be executed every time with the others.

This problem has nothing to do with the other extension, as I could have created the folder and files my self for whatever purpose. I just did name it here to show that this is not an unusual scenario.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

17reactions
dracomithrilcommented, Sep 19, 2021

it worked for me when I used exactly the same name as defined in folders as mentioned by @patspam

{
  "folders": [
  {
    "name": "✨ root",
    "path": "."
  },
  {
    "name": "📦 admin-tools",
    "path": "packages\\admin-tools"
   },
  {
    "name": "📦 @foo/functions",
    "path": "packages\\functions"
  },
  {
    "name": "📦 @foo/types",
    "path": "packages\\types"
  },
  {
    "name": "🚀 @foo/web",
    "path": "packages\\web"
  }
],
"settings": {
  "jest.disabledWorkspaceFolders": [
        "✨ root",
        "📦 admin-tools",
        "📦 @foo/types"
    ]
  }
}
3reactions
EmpireJonescommented, May 20, 2020

I believe vscode-jest auto-inserts the “jest.disabledWorkspaceFolders” settings into the wrong place when you click on the UI to insert it. I had to put it in my workspace settings and specifically put it inside the “settings” key/object, so in your case it’d look something like:

{
	"settings": {
		"jest.disabledWorkspaceFolders": [
			".history"
		],
	}
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

vscode jest extension doesn't work properly - Stack Overflow
I had been running tests using WSL2 with no issues (without the extension), but encountered "jest command not found" with the extension. After...
Read more >
Configuring Jest for Visual Studio Code - Beyond Java
The Jest plugin for VS Code is a bit shy. By default, it hides most of its helpful features. Here's how to unlock...
Read more >
vscode-jest - Visual Studio Marketplace
disabledWorkspaceFolders" to exclude the packages from jest run. Please note, a working jest environment is a prerequisite for this extension.
Read more >
Troubleshooting - Jest
Use this guide to resolve issues with Jest. ... There are multiple ways to debug Jest tests with Visual Studio Code's built-in debugger....
Read more >
Visual Studio Code tips for monorepo development with Multi ...
disabledWorkspaceFolders : Disable Jest when running from the ROOT and app1 folders, based on the folder names. Read more about troubleshooting ...
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