Webstorm 2017.3 Linux version Jest tests stops running

I have just updated both my Mac and Linux host to WebStorm 2017.03, seems the Jest support in the Linux version of 2017.03 is broken. I have deleted all the "Run/Debug configuration" under Jest before I run a random test from my project.

In 2017.2.5, after I open a filename.test.js and click "Run ***", it runs and in the below terminal the executed command is (I have replaced the folder path with {ProjectFolder})

 

/usr/local/bin/node {ProjectFolder}/node_modules/jest/bin/jest --config {\"rootDir\":\"{ProjectFolder}\",\"transformIgnorePatterns\":[\"/node_modules/\",\"^/opt/WebStorm/plugins/JavaScriptLanguage/helpers\"],\"unmockedModulePathPatterns\":[\"^/opt/WebStorm/plugins/JavaScriptLanguage/helpers\"]} --colors --setupTestFrameworkScriptFile /opt/WebStorm/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-jasmine.js --testPathPattern ^{ProjectFolder}/src/folder/sometest\.test\.js$ --testNamePattern "^Some Test "

In 2017.3, the command being executed is 

/usr/local/bin/node --require /opt/WebStorm/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-stdin-fix.js {ProjectFolder}/node_modules/jest/bin/jest.js --colors --testResultsProcessor /opt/WebStorm/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-test-results-processor.js --testPathPattern ^{ProjectFolder}/src/folder/sometest\.test\.js$ --testNamePattern "^Some Test "

 

Then it says no tests found

I copied out the command being run in 2017.3 and executed it in a separate terminal get the same result.

However, if I removed the "^" sign from the command( in "--testPathPattern ^/home/"), making it "--testPathPattern /home/". Then the test executes.

My suspicion is the auto generated testPathPattern by Webstorm is not considering when the user's home folder is a symbolic link. In my case /home/username is a symbolic link to /local/home/username

 

 

 

0
7 comments

What's the value of "Working directory" from your Jest run configuration? What's your jest package version? Thanks

0
Avatar
Permanently deleted user

Working directory is using tilde to refer to my home folder, ~/{Workspace}/src/{ProjectPackage}

The package I am working on is still using Jest 19.0.2

0

Probably, it's caused by how tilde is expanded by IDE. To find out the value of tilde, perform the following steps:

* On the main menu "Help | Find Action...", type "IDE Scripting Console" and click the only variant and select "ECMAScript" Script Engine

* Paste the following code in an opened ide-scripting.js file

print(java.lang.System.getProperty('user.home'))

* Position the text caret on a line with code and hit Ctrl+Enter to execute it. What's the output?

 

Please double check how jest sees its current directory: just add `console.log(process.cwd())` at the top of `{ProjectFolder}/node_modules/jest/bin/jest`.

Do both values have the same prefix?

0
Avatar
Permanently deleted user

* Output of print(java.lang.System.getProperty('user.home'))

> print(java.lang.System.getProperty('user.home'))
/home/{myusername}
[163ms]=> null

Not sure about where to add the `console.log(process.cwd())`, if means adding it to the jest.js file inside node_modules, the output after running a test is

/local/home/{myusername}/{Workspace}/src/{ProjectPackage}
No tests found

 

 

0
Avatar
Permanently deleted user

The above was run with 2017.03, I just reverted to 2017.2.5 and saw the exact same output, except the tests are running.

> print(java.lang.System.getProperty('user.home'))
/home/{myusername}
[112ms]=> null
/local/home/{myusername}/{Workspace}/src/{ProjectPackage}

The usage of `--testPathPattern ^/home/` was working under 2017.2.5, but not sure where it breaks after I upgraded to 2017.03

 

0

Thanks, reproduced. Filed as https://youtrack.jetbrains.com/issue/WEB-30087. So far the workaround is to open a project from its original location, not symlinked.

0
Avatar
Permanently deleted user

Thanks for the work around! Just opened the project from the original location and the tests are running!

0

Please sign in to leave a comment.