Jest Showing All Empty Test Suites When Running Single Test

Whenever I run a single test suite with jest (using the --testNamePattern=some_test_name), I get a lot of "Empty test suite." messages. Is there no way to label empty test suites as ignored so they don's show up on the test run console? See the image below:

 

Thanks!

13 comments

Please can you elaborate on this? are these suites indeed empty?

-1

As you can see, I'm running the tests with the "--=testPatternName=xxx" option - meaning it's effectively ignoring all other test not in the "xxx" suite. So yes, they are empty.

0

this option allows running only those tests and test suites that have names matching the specified pattern; other suites shouldn't be run at all, and using this option shouldn't normally result in empty test suites

0

I'd assume so, but I'm still seeing them - hence me coming here. I can send you my Run/Debug Configurations if that'd help?

0

Problem may be related to wrong working directory used when creating run configurations for individual tests - https://youtrack.jetbrains.com/issue/WEB-31201.

Can you check if changing the working dir to the folder where your package.json is located (project root dir?) makes things any better?

0

I've already set my default working directory to be my project's root directory for all my jest test - else the tests don't even run. So the results I sent initially was run with the working directory set to the project's root directory.

0

I see... I need a project to see what's wrong then. Please can you share it?

0

Unfortunately it's not my project, so I won't be able to share it. It used CRA (create react app) and here is the Run/Debug Configuration I'm using: 

 

0

Can you recreate the issue with a new project created with CRA?

0

I am seeing the same thing in version 2018.2.5. When running 'all' jest tests, my tests start but they all print "Empty test suite.". I can successfully run any individual one through the Webstorm just find but not as a whole.

It would be nice to not have to use the command line to run my full tests. 

 



0

I'm not aware of any issues that would cause this. I need a test project to see what's going on, there is no chance to get the bug fixed unless there is a way to reproduce it

0

After playing around I found that upgrading node from 6.3 to 8.8 test now now works as expected.

1

This was happening to me too using TypeScript and ts-jest. In my case, I solved it by installing the same major version for both jest and ts-jest

 

npm install --save-dev jest@23 ts-jest@23

I realized the issue because of a note in the ts-jest readmeWe DO NOT use SemVer for versioning. Tho you can think about SemVer when reading our version, except our major number follow the one of Jest. For the versions available, see the tags on this repository

 

1

Please sign in to leave a comment.