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

Jest stuck - keeps spinning, no output #128

Open
jchapuis opened this issue Jul 14, 2017 · 16 comments
Open

Jest stuck - keeps spinning, no output #128

jchapuis opened this issue Jul 14, 2017 · 16 comments

Comments

@jchapuis
Copy link

Environment

  1. node -v: v6.10.3

  2. npm -v: 3.10.10

  3. npm ls react-scripts (if you haven’t ejected):
    `-- (empty)
    npm ERR! code 1

  4. Operating system: Windows

Steps to Reproduce

No matter if start my project, or stop/start Jest - it keeps spinning and does nothing. One of five it suddenly works, then gets stuck again after a while.

There are some warnings in the developer console:

image

@GregOnNet
Copy link

GregOnNet commented Jul 17, 2017

Hey,

I experience the same error.
Having a look in the Output of Jest there is an error while spawning the git process.

image

Error: spawn git ENOENT
    at exports._errnoException (util.js:1014:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:189:19)
    at onErrorNT (internal/child_process.js:366:16)
    at _combinedTickCallback (internal/process/next_tick.js:102:11)
    at process._tickCallback (internal/process/next_tick.js:161:9)

System

  • Windows 10
  • npm 5.0.3
  • node v8.1.0
  • VSCode 1.14.1

I would love to see the Jest integration working in my VSCode. :-)
If you need further information please contact me.

Thanks in advance
Greg

UPDATE
For me it seems that the problem is that VSCode does not resolve the path to the installed git binary.
I don't think that my problems relate to vscode-jest itself.

UPDATE 2
VSCode does not support cygwin/git which I have installed: microsoft/vscode#7998
That's why vscode-jest does not start either.

UPDATE 3
After installing Git for Windows. The error "Error: spawn git ENOENT" is gone.
Now I stuck with the same problem @jchapuis described.
Jest tries to initialize itself but unfortunately nothing happens.

  1. image
  2. image

@bookman25
Copy link
Collaborator

Have you tried running jest standalone without the plugin? This plugin doesn't talk directly to git in any way, all of that logic is handled directly by jest.

@marcionicolau
Copy link

I get this from Developer Tools
MacOS X
VSCode: 1.16.0
Jest: 21.0.2

shell.ts:419 [Orta.vscode-jest] Cannot read property 'testRegex' of undefined: TypeError: Cannot read property 'testRegex' of undefined
at JestExt.wouldJestRunURI (/Users/nicolau/.vscode/extensions/Orta.vscode-jest-2.3.0/out/src/JestExt.js:253:64)
	at JestExt.canUpdateDecorators (/Users/nicolau/.vscode/extensions/Orta.vscode-jest-2.3.0/out/src/JestExt.js:249:34)
	at JestExt.triggerUpdateDecorations (/Users/nicolau/.vscode/extensions/Orta.vscode-jest-2.3.0/out/src/JestExt.js:131:19)
	at vscode.window.onDidChangeActiveTextEditor.editor (/Users/nicolau/.vscode/extensions/Orta.vscode-jest-2.3.0/out/src/fileChangeWatchers.js:9:21)
	at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:55287)
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:57078)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:393153
	at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:55287)
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:57078)
	at e.$acceptDocumentsAndEditorsDelta (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:351598)
	at t.e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:423958)
	at e._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:280554)
	at e._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:280244)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:279271
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:281190
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:56058
	at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:55287)
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:57078)
	at Socket.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:28:102495)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Socket.Readable.push (_stream_readable.js:136:10)
	at Pipe.onread (net.js:560:20)

@bookman25
Copy link
Collaborator

This error points to a failure to load jest settings. Any chance you have a sample repo we can clone to try to reproduce?

@dennisreimann
Copy link

I experience a similar problem, here is the output of the Developer Tools Console:

shell.ts:459 [Orta.vscode-jest] Cannot read property 'forEach' of null: TypeError: Cannot read property 'forEach' of null
	at JestExt.sortDecorationBlocks (/Users/dennisreimann/.vscode/extensions/Orta.vscode-jest-2.4.5/out/src/JestExt.js:187:19)
	at JestExt.updateDotDecorators (/Users/dennisreimann/.vscode/extensions/Orta.vscode-jest-2.4.5/out/src/JestExt.js:220:74)
	at JestExt.triggerUpdateDecorations (/Users/dennisreimann/.vscode/extensions/Orta.vscode-jest-2.4.5/out/src/JestExt.js:171:14)
	at vscode.window.onDidChangeActiveTextEditor.editor (/Users/dennisreimann/.vscode/extensions/Orta.vscode-jest-2.4.5/out/src/fileChangeWatchers.js:9:21)
	at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:84411)
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:86133)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:479691
	at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:84411)
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:86133)
	at e.$acceptDocumentsAndEditorsDelta (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:430508)
	at t.e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:509443)
	at e._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:354786)
	at e._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:354476)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:353503
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:355422
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:85128
	at e.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:84411)
	at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:86133)
	at Socket.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:144114)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)

This happens on startup, after that the Jest extension ist stuck with "testing changes".

Jest extension version: 2.4.5
Jest and Jest CLI version: 21.2.1

jest.config.js:

module.exports = {
  'mapCoverage': true,
  'moduleFileExtensions': [
    'js',
    'vue'
  ],
  'moduleNameMapper': {
    '^@/(.*)$': '<rootDir>/src/vue/$1'
  },
  'snapshotSerializers': [
    '<rootDir>/node_modules/jest-serializer-vue'
  ],
  testMatch: [
    '**/test/unit/**/?(*.)spec.js'
  ],
  'transform': {
    '^.+\\.js$': '<rootDir>/node_modules/babel-jest',
    '.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
  }
}

@seanpoulter
Copy link
Member

Thanks for sharing your problem @dennisreimann. Looking through sortDecorationBlocks and updateDotDecorators it looks like assertions was likely null. This was recently fixed by @BBB in #169 but it hasn't been published yet.

@seanpoulter
Copy link
Member

@dennisreimann, the fix has been published.
Closing since we seem to have resolved these.

@dennisreimann
Copy link

I can confirm that the error message in the VS Code dev console is gone now. Nevertheless the extension is still stuck with "testing changes". There is no more error output I can send to debug, the Jest console is empty as well.

jest

Any way I can provide more feedback/debugging info? Thanks!

@BenAychh
Copy link

Probably related to jestjs/jest#4419, try creating a git repo inside or waiting until the fix is released. At least this fixed it for me.

@seanpoulter
Copy link
Member

I missed your reply, sorry @dennisreimann.

Is the project set up in a git or hg repo?
Can you reproduce it with a small repo we can clone?
Are you willing to try debugging the extension with our help?

@dennisreimann
Copy link

@seanpoulter unfortunately this isn't a public project.

Are you willing to try debugging the extension with our help?

Of course – is this something we can have a quick look at together in a screensharing session? Otherwise I will try to come up with a similar setup in a separate repo you can reproduce the problem with.

@seanpoulter
Copy link
Member

I'd be happy to try and figure this out on a screenshare @dennisreimann!

Here's where I'd suggest we start to figure out what's happened so far, and where it's stuck:

  • clone this repo git clone https://github.com/orta/vscode-jest.git
  • open the repo folder in Visual Studio Code
  • find the testsHaveStartedRunning() method in JestExt.ts:
    • comment out the call to clear() the Jest output channel
    • add a breakpoint in the method -- if we're stuck here, then we can try and figure out how we get here
  • start the "Launch Extension" debug task
  • in the window that opens, open your repo that causes problems

@seanpoulter seanpoulter reopened this Dec 14, 2017
@dennisreimann
Copy link

Ok, I checked whether or not I can come up with more debuggable output using the steps you provided. I guess this is related, the debugging console outputs this message a few seconds after I save a test file:

Array[1]
  0:Object
    code:"ECONNREFUSED"
    errno:"ECONNREFUSED"
    syscall:"connect"
    address:"0.0.0.0"
    port:443

However, I don't get to the breakpoint I've set in the testsHaveStartedRunning method. So lets just conect via screensharing. Please send me an email (see the mail address in my GH profile) and we can arrange a time this weekend or in the upcoming week :)

@dennisreimann
Copy link

I found the culprit: We are using Webpack's resolve.alias feature. This leads to files that cannot be resolved by the vscode-jest extension, so the tests can't be run.

The relevant webpack config part:

module.exports = {
  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      '@': resolve('src'),
    }
  }
}

An import example:

// with resolve.alias 
import FormField from '@/vue/components/FormField'
// regular import
import FormField from '../../components/FormField'

If this is something you would like to fix, you can leave the issue open and I'll try to provide a test project. Otherwise you can close this issue as this case might be to special to address.

Thanks for your help!

@seanpoulter
Copy link
Member

Wow, glad you found it @dennisreimann!

I'm happy to keep the issue open and make sure we're properly handling the moduleNameMapper option in your jest.config.js. There's something going on if it works from the command line but not in the extension. That should be pretty quick to test.

@seanpoulter
Copy link
Member

seanpoulter commented Dec 14, 2017

I'm not convinced that the module resolution is the root cause. This minimal repo worked OK. 😕 The only time it I got the "testing changes" spinner was before setting up a git repo and getting the Error: This promise must be present when running with -o. error from #142.

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

No branches or pull requests

7 participants