Closed SchuylerGoodman closed 6 years ago
Looks like a syntax error parsing your source code, anything unique in there?
Not that I can tell, and it doesn't tell me what code is causing the syntax error. TSLint doesn't catch anything wrong with the code. Could it be related at all to the 'This extension relies on Jest 20+ features, it will continue to work, but some features may not work correctly.' error, or is that a completely different issue? I am using Jest 22.1.4.
Is it possible to recreate the problem with less code @SchuylerGoodman? It would be helpful to know which folder you opened in Visual Studio Code, and how the Jest extension started running as well (e.g.: did you start it, or did it start automatically).
I can get pretty close with plain JavaScript and adding a folder into the Visual Studio Code workspace which contains an app/
directory this is a Node.js project. The extension will not start automatically. If you manually start the extension with "Jest: Start Runner", we don't find Jest in the expected places in node_modules/
in the workspace root and we'll show an error. You can change the "root" directory by setting the jest.rootPath
workspace setting.
Once Jest starts and fails, the Debug CodeLens appears without a Jest binary to launch. It will fail and show the error message you explained. It might be worth cleaning that up in the future.
As for your stack trace -- it'd be great to have more details how to get there from a minimal repo. I didn't have any luck reproducing the problem with a trivial TypeScript/ts-jest
repo. I'd expect an error like that to be thrown from our helper library if we tried to parse a TypeScript annotation in a JavaScript file. We're using Babylon to parse files and determine where to put the dot annotations.
Using your advice I was able to get it working by changing jest.rootPath
to ./App
(which is my app directory in the workspace), but I still have to manually start the extension, even though jest.autoEnable
is set to true
. I'm satisfied with it working as-is, though, so I'll close the issue here. Thanks for the help!
Does the extension start automatically when you reload the window (with the Reload Window command)? Most of those settings require the extension to be restarted.
Environment
node -v
: [8.9.4]npm -v
: [5.6.0].NET Core 2.0
Operating system: [Windows 10 Enterprise 1709]
Steps to Reproduce
git clone https://github.com/SchuylerGoodman/vscode-jest-dotnet-core-2.0.git dotnet restore npm i
open Visual Studio Code install vscode-jest (and start) navigate to ./App/ClientApp/state/tests/test.ts click vscode-jest generated 'Debug' link
Project is modified version of project generated by 'dotnet new reactredux'
Expected Behavior
Starts debug session for test case
Actual Behavior
Error message: This extension relies on Jest 20+ features, it will continue to work, but some features may not work correctly.
Error message: Running the contributed command:'io.orta.jest.run-test' failed.
From developer tools: ERR Unexpected token (21:63): SyntaxError: Unexpected token (21:63) at Parser.pp$5.raise (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:4454:13) at Parser.pp.unexpected (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:1761:8) at Parser.pp$3.parseParenAndDistinguishExpression (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3859:10) at Parser.pp$3.parseExprAtom (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3709:19) at Parser.parseExprAtom (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:7238:22) at Parser.pp$3.parseExprSubscripts (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3494:19) at Parser.pp$3.parseMaybeUnary (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3474:19) at Parser.pp$3.parseExprOp (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3435:42) at Parser.pp$3.parseExprOp (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3438:19) at Parser.pp$3.parseExprOps (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3408:17) at Parser.pp$3.parseMaybeConditional (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3381:19) at Parser.pp$3.parseMaybeAssign (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:3344:19) at Parser.parseMaybeAssign (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:6474:20) at Parser.pp$1.parseVar (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:2340:24) at Parser.pp$1.parseVarStatement (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:2169:8) at Parser.pp$1.parseStatement (C:*.vscode\extensions\Orta.vscode-jest-2.6.0\node_modules\babylon\lib\index.js:1861:19)
Note we are looking for someone to take responsibility around keeping create-react-app up to date and working, could this be you?