swc-project / pkgs

node.js packages for SWC
62 stars 20 forks source link

@swc/jest code coverage is different when passing maxWorkers=1 using v8 coverage provider #61

Open abnud11 opened 1 month ago

abnud11 commented 1 month ago

I'm using @swc/jest with jest 29, I'm currently testing a Next.js app and have configured a global coverage treshold.

The problem is, on Github Actions my CI Server, coverage fails.

locally it succeeds, but when passing --maxWorkers=1 simulating what happens on CI Server, it fails too.

So in summary, coverage becomes different when passing --maxWorkers=1, I don't have any global state or tests that rely on each other, also the uncovered lines seem wrong to me since they should be covered by tests. all tested code is frontend React code.

the coverage provider I'm using is V8. I'm using Typescript 5.6 in both test code and tested code.

My OS Is Arch Linux, Node.js version is 20.17, jest version is 29.7, @swc/jest version is 0.2.36