Skip to content

fix(jest-runner): resolve testEnvironment before coverage wrap - #6219

Open
Steve0x2a wants to merge 1 commit into
stryker-mutator:masterfrom
Steve0x2a:fix/jest-runner-resolve-test-environment
Open

fix(jest-runner): resolve testEnvironment before coverage wrap#6219
Steve0x2a wants to merge 1 commit into
stryker-mutator:masterfrom
Steve0x2a:fix/jest-runner-resolve-test-environment

Conversation

@Steve0x2a

Copy link
Copy Markdown

Fixes #6108

Credit: @offline2k-coder

When coverageAnalysis is "perTest" or "all", @stryker-mutator/jest-runner swaps in its coverage-forwarding testEnvironment using the raw, un-normalized Jest config from readInitialOptions. That leaves <rootDir>/… unresolved (MODULE_NOT_FOUND) and silently drops a preset-provided environment in favor of jest-environment-node.

Resolve <rootDir> (the same substitution Jest's normalize uses) and read testEnvironment from a preset when the raw config omits it, before storing state.jestEnvironment.

Regression: <rootDir>/custom-env.js under coverageAnalysis: "perTest".

Expand <rootDir> and honor preset-provided testEnvironment before storing
state.jestEnvironment for the coverage wrapper.

Fixes stryker-mutator#6108

Signed-off-by: Yi Zhan <stevesough@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant