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 runs but editor integration fails #80

Closed
tzapu opened this issue Feb 16, 2017 · 10 comments
Closed

jest runs but editor integration fails #80

tzapu opened this issue Feb 16, 2017 · 10 comments

Comments

@tzapu
Copy link

tzapu commented Feb 16, 2017

Hello,

Tried to use the extension today, but it seems to work only in part for me.

  • got jest auto running in the bar
  • the output shows the problems
  • no update snapshot dialog is shown
  • no editor integration showing problems is shown
  • i get these errors in the developer tools console
//Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:133 [Extension Host] Uncaught Exception:  SyntaxError: Unexpected token, expected , (31:6)d.logExtensionHostMessage @ //Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:133
//Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:133 [Extension Host] SyntaxError: Unexpected token, expected , (31:6)
    at Parser.pp$5.raise (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:4246:13)
    at Parser.pp.unexpected (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:1627:8)
    at Parser.pp.expect (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:1615:33)
    at Parser.pp$7.flowParseTypeParameterDeclaration (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:4645:12)
    at Parser.parseMaybeAssign (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:5674:33)
    at Parser.pp$3.parseExprListItem (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:4101:16)
    at Parser.parseExprListItem (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:5425:24)
    at Parser.pp$3.parseCallExpressionArguments (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3410:20)
    at Parser.pp$3.parseSubscripts (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3370:31)
    at Parser.pp$3.parseExprSubscripts (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3341:15)
    at Parser.pp$3.parseMaybeUnary (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3311:19)
    at Parser.pp$3.parseExprOps (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3241:19)
    at Parser.pp$3.parseMaybeConditional (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3218:19)
    at Parser.pp$3.parseMaybeAssign (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3181:19)
    at Parser.parseMaybeAssign (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:5694:20)
    at Parser.pp$1.parseVar (/Users/alex/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:2205:24)
  • vscode version is 2.1.6

Not sure what else i could provide as details, please let me know.
Cheers

@TuiKiken
Copy link

The same problem.

@Rauttis
Copy link

Rauttis commented Feb 27, 2017

Similar issue here, works fine in one of my projects but not in another, not sure what the difference is.

//Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:138 Unexpected token, expected , (58:39): SyntaxError: Unexpected token, expected , (58:39)
    at Parser.pp$5.raise (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:4246:13)
    at Parser.pp.unexpected (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:1627:8)
    at Parser.pp.expect (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:1615:33)
    at Parser.pp$7.flowParseTypeParameterDeclaration (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:4645:12)
    at Parser.parseMaybeAssign (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:5674:33)
    at Parser.pp$3.parseExprListItem (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:4101:16)
    at Parser.parseExprListItem (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:5425:24)
    at Parser.pp$3.parseCallExpressionArguments (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3410:20)
    at Parser.pp$3.parseSubscripts (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3370:31)
    at Parser.pp$3.parseExprSubscripts (/Users/niklasa/.vscode/extensions/Orta.vscode-jest-2.0.5/node_modules/jest-editor-support/node_modules/babylon/lib/index.js:3341:15)

vscode 1.9.1

Here's my .babelrc since the error seems to be coming from babylon:

{
  "presets": ["es2015", "stage-2", "react"],
  "plugins": ["transform-flow-strip-types"]
}

@eranimo
Copy link

eranimo commented Feb 27, 2017

Same here. Very strange, because this feature worked when I initially downloaded the extension but broke when I did a refresh when I installed eslint.

@etiennedi
Copy link

etiennedi commented Mar 5, 2017

I'm having the same issue and I just cloned the repo and started to investigate a bit. The error occurs in JestExt.triggerUpdateDecorations when calling this.parseResults = parse(editor.document.uri.fsPath);.

parse is imported from jest-editor-support. So, there is most likely nothing wrong in vscode-jest. It'll probably be an issue with either jest-editor-support or even babylon directly.

Update: Some more context: I'm getting the parse error on the .spec file in a line and column containing JSX. So, this seems as if jest-editor-support/babylon isn't using the plugins/presets in .babelrc to parse the spec file.

@orta How do we go from here? I'd love to contribute. I'll check jest-editor-support for some issues next. Regardless of this particular error, how do you feel about wrapping critical function calls like this in a try...catch? We could still throw to the console (or even use a VSCode error dialog). But more importantly, we could add a lot of info where the error occurred. Something like "Couldn't update Decorations, parsing the source file failed with the following error..." would have probably helped here quite a bit.

@etiennedi
Copy link

etiennedi commented Mar 5, 2017

Update: I believe I found the issue, see jestjs/jest#3070.

@orta
Copy link
Member

orta commented Mar 6, 2017 via email

@etiennedi
Copy link

Don't worry about it - the issues are most likely in other packages anyway. Enjoy your honeymoon!

@tzapu
Copy link
Author

tzapu commented Mar 6, 2017 via email

@etiennedi
Copy link

My PR on facebook/jest has been merged and the issue there has been closed. Let's keep this one open until the changes in jest and therefore jest-editor-support have been released. At least the error I had is gone with the changes.

@bookman25
Copy link
Collaborator

vscode-jest should have the latest version of jest-editor-support at this time.

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

No branches or pull requests

7 participants