Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running jest tests directly in Intellij Idea/WebStorm?

I'm using jest to write tests in my ReactJS application. So far, to run my test suite, I need to type 'npm test'.

Here's the snippet from package.npm:

 "scripts": {
    "test": "./node_modules/.bin/jest",
    (other stuff)
  },
  "jest": {
    "unmockedModulePathPatterns": ["<rootDir>/node_modules/react"],
    "scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
    "testFileExtensions": [
      "es6",
      "js"
    ],
    "moduleFileExtensions": [
      "js",
      "json",
      "es6"
    ]
  },

Is it possible to run those tests within my IDE (IDEA/WebStorm) directly, preserving the configuration? I'm not a js guy, but for example WebStrom works perfectly fine with Karma. Shouldn't this be possible with jest-cli either?

like image 384
slnowak Avatar asked Apr 27 '15 19:04

slnowak


1 Answers

To make Jest test results shown in a tree view (like karma, etc.), a special integration is needed. WebStorm doesn't yet support Jest. Please vote for WEB-14979 to be notified on any progress.


EDIT: as of March 2017 the first version of Jest integration at WebStorm has been released.

like image 58
lena Avatar answered Sep 28 '22 06:09

lena