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!

16 comments
Comment actions Permalink

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

-1
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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

0
Comment actions Permalink

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
Comment actions Permalink

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

0
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

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

1
Comment actions Permalink

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
Comment actions Permalink

I had the same issue, but upgrading from Webstorm 2018.2.x to 2018.3.5 solved my issue

1
Comment actions Permalink

Thanks, had the same issue and solved it by downgrading jest and ts-jest.

2
Comment actions Permalink

Same. I upgraded PhpStorm to 2019.1. It's working now.

0

Please sign in to leave a comment.