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!
请先登录再写评论。
Please can you elaborate on this? are these suites indeed empty?
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.
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
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?
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?
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.
I see... I need a project to see what's wrong then. Please can you share it?
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:
Can you recreate the issue with a new project created with CRA?
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.
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
After playing around I found that upgrading node from 6.3 to 8.8 test now now works as expected.
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 readme: We 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
I had the same issue, but upgrading from Webstorm 2018.2.x to 2018.3.5 solved my issue
Thanks, had the same issue and solved it by downgrading jest and ts-jest.
Same. I upgraded PhpStorm to 2019.1. It's working now.
Was facing the same issue. Upgrading to 2019.X solved it.