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.

vscode-jest not supporting projects with Babel

See original GitHub issue

Environment

  1. node -v: 10.10.0

  2. npm -v: 6.1.0

  3. npm ls jest 23.6.0

  4. Operating system: Windows

Prerequisite

  • are you able to run jest test from command line? yes
  • how do yo run your tests from command line? yarn test or npx jest Working fine. It’s also working fine from VS Code terminal.

Steps to Reproduce

Just create any project that using Babel and jest and try to open it in VS Code with this plugin.

Relevant Debug Info

FAIL tests/myCode-test.js

● Test suite failed to run

Jest encountered an unexpected token

I tried to turn on debugging by creating my project/.vscode/settings.json:

{ “jest.debugMode”: true }

But there’s no debug messages in the DevTools console so I can’t get more information.

I tried to add echo in the jest command line itself. I found out that it’s not executing the project’s jest but some other jest I don’t know from where. Maybe this plugin has it’s own special version of jest.

Expected Behavior

To work like from the command line.

Actual Behavior

FAIL tests/myCode-test.js

● Test suite failed to run

Jest encountered an unexpected token

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:6

github_iconTop GitHub Comments

2reactions
connectdotzcommented, Jun 6, 2019

yes, in your project-root > .vscode > settings.json:

{
...
    "jest.pathToJest": "yarn test"
}
0reactions
Ziv-Barbercommented, Jun 5, 2019

how do yo run your tests from command line? yarn test

if you expect the plugin to execute yarn test, please set your jest.pathToJest accordingly, see troubleshooting

Can you post the instructions how to do that?

When I run yarn test everything working fine. I just need a way to make the vscode jest plugin to do the same. The “troubleshooting” section saying something that it’s possible but not how to do it.

Is it “jest.pathToJest”: “yarn test --” ???

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest + Babel in VS Code debugger causes breakpoints to move
I am trying to debug a simple project using babel, jest, and vs code. When I set a breakpoint and then start debugging,...
Read more >
Troubleshooting - Jest
Try using the debugging support built into Node. Place a debugger; statement in any of your tests, and then, in your project's directory, ......
Read more >
vscode-jest-runner - Visual Studio Marketplace
Extension for Visual Studio Code - Simple way to run or debug a single (or multiple) tests from context-menu.
Read more >
Switching a Jest Project from Babel to SWC - Goldblog
Configure SWC to not compile away generators or async/await code. Generators and async/await have been fully supported in Node for years, ...
Read more >
Tooling - styled-components
Tooling. Babel Plugin. This plugin adds support for server-side rendering, minification of styles, and a ...
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