jest-runner-groups icon indicating copy to clipboard operation
jest-runner-groups copied to clipboard

0 results when using groups runner?

Open wilcoxpdfrd opened this issue 2 years ago • 7 comments

Having a weird issue that just started on my macbook. We've been using this runner for some time with our node projects but recently when I merged a local git project from master, and did an npm update, when I try to run a group of tests:

jest --config ./jest.config.unit.js --collectCoverage --collectCoverageFrom="src/**/*.js" --coverageReporters clover json lcov text text-summary cobertura --coverageDirectory="./coverage" --group=ut --reporters=default --reporters=jest-junit --watchAll=false --verbose --runInBand --forceExit --detectOpenHandles"

I'm just seeing results:

Test Suites: 0 of 9 total Tests: 0 total Snapshots: 0 total Time: 0.456 s, estimated 2 s Ran all test suites.

The test files include:

/**

  • @group ut */

So it seems to not recognize the group attribute in the test files perhaps? If I remove the runner: 'groups' from jest.config.unit.js-module.exports json the tests run fine:

Test Suites: 9 passed, 9 total Tests: 54 passed, 54 total Snapshots: 0 total Time: 3.801 s, estimated 44 s Ran all test suites.

Really stumped; can't find anything online to help. I've tried re-installing the runner and played around with things ... no luck ... And my team mates don't have this issue when they pull my branch. Any thoughts?

Thanks, Paul

wilcoxpdfrd avatar May 24 '22 20:05 wilcoxpdfrd

Same issue 👀

Haven't figured out yet what's happening. Wondering if it's related to versions? I just got to the "oh, they run when commenting out the runner in config" realization

seanspeaks avatar May 30 '22 22:05 seanspeaks

@wilcoxpdfrd Are you working on a monorepo/with npm workspaces?

I'm finding that when I run npm install with workspaces, groups is failing. When I install in each folder and remove workspaces, I get success.

seanspeaks avatar May 31 '22 19:05 seanspeaks

Not sure if that's the culprit, I'm going to just tear out and go with regex for now until someone smarter than I can understand what's happening (Feels like modules path/install thing)

seanspeaks avatar May 31 '22 20:05 seanspeaks

@seanspeaks Nope, not installing with workspaces ... interesting that would cause the issue we're seeing, but doesn't explain what's happening in my case ...

By regex you mean in jest.config.js testMatch I assume? Interestingly we have also defined regexes to our test folder paths, and I played around with that to see if that could be interfering with groups without success. But no one else on my team sharing our repo has the issue, so that doesn't seem to be the problem either.

wilcoxpdfrd avatar May 31 '22 20:05 wilcoxpdfrd

Got a hint from another engineer who saw this issue on an older version of node, he downgraded npm which fixed the issue for him ... what I did for my project (which I realize now is on node 12 - I'll be addressing upgrading versions soon as I know 12 is EOL) is:

// this selects node v16.0.0 for me nvm use system

// then nvm uninstall v12.22.12 nvm install v12.22.12 nvm use v12.22.12

//deleted node_modules folder and package-lock.js in my project, then:

npm i

// then jest --config ./jest.config.unit.js --collectCoverage --collectCoverageFrom="src/**/*.js" --coverageReporters clover json lcov text text-summary cobertura --coverageDirectory="./coverage" --group=ut --reporters=default --reporters=jest-junit --watchAll=false --verbose --runInBand --forceExit --detectOpenHandles"

// and got Test Suites: 9 passed, 9 total Tests: 54 passed, 54 total Snapshots: 0 total Time: 5.905 s

Yay!

I'll leave this open for a bit in case the problem comes back or for other comments ...

wilcoxpdfrd avatar Jun 01 '22 21:06 wilcoxpdfrd

I encountered this bug too in jest-runner-groups v2.2.0. Have Node v14.18.2 and npm workspaces. Downgrading to "jest-runner-groups": "2.1.0" (with the strict fixed version of the library to avoid auto-upgrades) helped to fix the issue for me.

MaxGenash avatar Jun 22 '22 15:06 MaxGenash

We noticed the same issue with jest-runner-groups of version v2.2.0, v2.1.0 after upgrading from Node 14.16.0 to 16.13.0. The tests have been executed with jest version 27.2.3 and ts-jest of version 27.0.5. Upgrading the packages to the latest version solved the issue.

  "devDependencies": {
    "jest": "28.1.1",
    "jest-runner-groups": "2.2.0",
    "ts-jest": "28.0.5"
  }

sschmeck avatar Jun 27 '22 07:06 sschmeck