The bug is triggered when coverageAnalysisis set to perTest as that invokes withCoverageAnalysis that in turn uses semver package to test the jest current version and checks if its >= 27. This check fails when using a prerelease version:
Relevant config options to trigger the bug are "testRunner": "jest" and "coverageAnalysis": "perTest"withCoverageAnalysis that in turn checks the jest version to set some configuration options. The version check doesn't coerce prerelease versions so the else branch is taken here for jest version 30.0.0-alpha.6.
Summary
Stryker
jest-runner
crashes withCannot read properties of undefined (reading 'getEnv')
at this line https://github.com/stryker-mutator/stryker-js/blob/2faded7848d67ec306e1f65a00586c5cd3f6604d/packages/jest-runner/src/jest-plugins/jasmine2-setup-coverage-analysis.cts#L2 with these options:"testRunner": "jest",
"coverageAnalysis": "perTest"` when running with a jest prerelease version (e.g. latest jest prerelease version at the time is 30.0.0-alpha.6.The bug is triggered when
coverageAnalysis
is set toperTest
as that invokeswithCoverageAnalysis
that in turn usessemver
package to test the jest current version and checks if its >= 27. This check fails when using a prerelease version:Stryker config
Relevant config options to trigger the bug are
"testRunner": "jest"
and"coverageAnalysis": "perTest"
withCoverageAnalysis
that in turn checks the jest version to set some configuration options. The version check doesn't coerce prerelease versions so the else branch is taken here for jest version 30.0.0-alpha.6.Test runner config
No relevant
Stryker environment
Test runner environment
Not relevant
Your Environment
Not relevant