Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode-jest stopping at launch of VSCode #360

Closed
talentedjerkkk23 opened this issue Aug 13, 2018 · 9 comments · Fixed by jest-community/jest-editor-support#21
Closed

vscode-jest stopping at launch of VSCode #360

talentedjerkkk23 opened this issue Aug 13, 2018 · 9 comments · Fixed by jest-community/jest-editor-support#21

Comments

@talentedjerkkk23
Copy link

Environment

  1. node -v: v9.4.0
  2. npm -v: 6.3.0
  3. VSCode: 1.25.1
  4. Operating system: Windows 7 x64

Prerequisite

  • are you able to run jest test from command line? yes
  • how do yo run your tests from command line? yarn test

Steps to Reproduce

  1. Install Jest as dev-dependency
  2. Create jest.config.js with following:
    module.exports = { verbose: true, testURL: "http://localhost/", }

Expected Behavior

vscode-jest should work

Actual Behavior

After opening project with jest in VSCode:

  • vscode-jest stopped and printed the following: Starting Jest in Watch mode failed too many times and has been stopped.
  • after reloading VSCode 100+ times - vscode-jest started working properly
  • after another VSCode window reload vscode-jest stopped again
@Flavien-Pensato
Copy link

Did you try without testURL ?

@talentedjerkkk23
Copy link
Author

@Flavien-Pensato yes, same thing

@connectdotz
Copy link
Collaborator

a few things to try:

  1. do self-diagnosis: turning on the debug mode and see what command vscode-jest used to spaw your jest
  2. if vscode-jest is not using yarn test, you can override it by setting the jest.pathToJest.

@talentedjerkkk23
Copy link
Author

talentedjerkkk23 commented Aug 13, 2018

@connectdotz extension runs using yarn jest as i can see using debug mode.

@connectdotz
Copy link
Collaborator

if the easy method didn't yield any hint, then the best way to approach this is to create a sample repo so we can cut through all these inefficient back-and-forth guesswork...

@oleersoy
Copy link

I'm having the same problem.

Jest is trying to scan the node_modules directory for tests even though I tell it to ignore it in package.json:

  "jest": {
    "testPathIgnorePatterns": [".test", "node_modules"]
  },

This is the console output:

jest-haste-map: @providesModule naming collision:
  Duplicate module name: prototype project
  Paths: /home/ole/SuperflyCSS/cli/test/sandbox/d5245d4c-b921-4e2a-9962-c82238ce0419/test/newproject/package.json collides with /home/ole/SuperflyCSS/cli/test/sandbox/7ab8e351-79e5-49c5-8f3c-ce0dd44d87c4/test/newproject/package.json

This warning is caused by a @providesModule declaration with the same name across two different files.

internal/fs/watchers.js:173
    throw error;
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/ole/SuperflyCSS/cli/test/sandbox/7ab8e351-79e5-49c5-8f3c-ce0dd44d87c4/test/newproject/src'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1269:11)
    at NodeWatcher.watchdir (/home/ole/SuperflyCSS/cli/node_modules/sane/src/node_watcher.js:175:20)
    at Walker.<anonymous> (/home/ole/SuperflyCSS/cli/node_modules/sane/src/common.js:116:12)
    at Walker.emit (events.js:182:13)
    at /home/ole/SuperflyCSS/cli/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/ole/SuperflyCSS/cli/node_modules/graceful-fs/graceful-fs.js:149:14)
    at FSReqCallback.oncomplete (fs.js:148:20)

internal/fs/watchers.js:173
    throw error;
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/ole/SuperflyCSS/cli/node_modules/unique-string'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1269:11)
    at NodeWatcher.watchdir (/home/ole/SuperflyCSS/cli/node_modules/sane/src/node_watcher.js:175:20)
    at Walker.<anonymous> (/home/ole/SuperflyCSS/cli/node_modules/sane/src/common.js:116:12)
    at Walker.emit (events.js:182:13)
    at /home/ole/SuperflyCSS/cli/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/ole/SuperflyCSS/cli/node_modules/graceful-fs/graceful-fs.js:149:14)
    at FSReqCallback.oncomplete (fs.js:148:20)

internal/fs/watchers.js:173
    throw error;
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/ole/SuperflyCSS/cli/node_modules/unique-string'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1269:11)
    at NodeWatcher.watchdir (/home/ole/SuperflyCSS/cli/node_modules/sane/src/node_watcher.js:175:20)
    at Walker.<anonymous> (/home/ole/SuperflyCSS/cli/node_modules/sane/src/common.js:116:12)
    at Walker.emit (events.js:182:13)
    at /home/ole/SuperflyCSS/cli/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/ole/SuperflyCSS/cli/node_modules/graceful-fs/graceful-fs.js:149:14)
    at FSReqCallback.oncomplete (fs.js:148:20)

internal/fs/watchers.js:173
    throw error;
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/ole/SuperflyCSS/cli/node_modules/unique-string'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1269:11)
    at NodeWatcher.watchdir (/home/ole/SuperflyCSS/cli/node_modules/sane/src/node_watcher.js:175:20)
    at Walker.<anonymous> (/home/ole/SuperflyCSS/cli/node_modules/sane/src/common.js:116:12)
    at Walker.emit (events.js:182:13)
    at /home/ole/SuperflyCSS/cli/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/ole/SuperflyCSS/cli/node_modules/graceful-fs/graceful-fs.js:149:14)
    at FSReqCallback.oncomplete (fs.js:148:20)

internal/fs/watchers.js:173
    throw error;
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/ole/SuperflyCSS/cli/node_modules/unique-string'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1269:11)
    at NodeWatcher.watchdir (/home/ole/SuperflyCSS/cli/node_modules/sane/src/node_watcher.js:175:20)
    at Walker.<anonymous> (/home/ole/SuperflyCSS/cli/node_modules/sane/src/common.js:116:12)
    at Walker.emit (events.js:182:13)
    at /home/ole/SuperflyCSS/cli/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/ole/SuperflyCSS/cli/node_modules/graceful-fs/graceful-fs.js:149:14)
    at FSReqCallback.oncomplete (fs.js:148:20)

Starting Jest in Watch mode failed too many times and has been stopped.
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting


@jackdbd
Copy link

jackdbd commented Feb 17, 2019

It looks the same issue described (and solved) here.

@Mahakb
Copy link

Mahakb commented Mar 29, 2019

I also faced this issue. And the issue was with the name of my Project.

The Project Name should not have any space in it. Once, I changed the name of the project it worked perfectly for me.

@simlevesque
Copy link

If you see this, just know that it's most likely related to Jest watching every files inside your node_modules directory.

Add this to your jest config:

{
    "modulePathIgnorePatterns": [
      "node_modules"
    ]
  }

And then kill all node process currrently running killall -9 node.

It should fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants