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.

Jest - Debug usage with WebStorm

See original GitHub issue

Webstorm natively supports debugging tests (single test, multiple tests, whole file) with jest. But since this plugin requires to invoke tests using serverless-bundle script, it’s somewhat incompatible with WebStorm’s native way of running tests and results with “Jest encountered an unexpected token” because it can’t understand ES6 import/export (it’s not running jest through webpack/babel)

What’s the recommended way to configure WebStorm with serverless-bundle? Or is there any known workaround? (I believe it’s possible to configure webstorm to run tests through serverless-bundle, but haven’t figured out how yet)



Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

markisadesignerdcommented, Feb 5, 2020

@Vadorequest, @patrykkrawczyk: The way I worked around this was to:

  1. Add jest@24.9.0 as a devDependency to my own project’s package.json (optional I think, but otherwise WebStorm wouldn’t display the inline test/debug icon in the editor)
  2. Create a jest.config.js file in your project’s root that loads the serverless-bundle config:
// jest.config.js
const path = require('path');
const createJestConfig = require('serverless-bundle/scripts/config/createJestConfig');
const relativePath = (relativePath) => path.resolve(__dirname, 'node_modules/serverless-bundle', relativePath);
module.exports = createJestConfig(relativePath, __dirname);
  1. Update your Jest Run/Debug configuration to use the Configuration file from step 2 and the Jest package from serverless-bundle, e.g.: {your-project-root}/node_modules/serverless-bundle/node_modules/jest image

That seemed to do the trick for me.

patrykkrawczykcommented, Dec 3, 2019

any progress on this? running tests with serverless-bundle test in terminal seems medieval

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run/Debug Configuration: Jest - WebStorm - JetBrains
Launch Web Browser: select this option to have a browser started. · Run External tool: select to run an external application. · Run...
Read more >
Testing and Debugging Happily with WebStorm, Jest and ...
Problem #1: Why can't you launch my tests??? ... ... herein follow the Necromicon of usage info for the react-scripts command ... ......
Read more >
Debug Jest in a NRWL/nx project with webstorm - Yonatan Kra
Open your NRWL/nx project in webstorm (we have to start with some common ground here…) · Make sure you have a lib or...
Read more >
Running jest tests directly in Intellij Idea/WebStorm?
I just setup Webstorm 2017.1.4 to natively use Jest for debugging. Click on the Configurations drop down, select Edit Configurations, click the green...
Read more >
Configuring and debugging Typescript Jest tests in WebStorm
Almost there! All that's left to do is add the Run Configuration to WebStorm, in the top right corner or in Run ->...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found