fix(testing): infer task inputs from jest config file references#34740
fix(testing): infer task inputs from jest config file references#34740leosvelperez wants to merge 4 commits intomasterfrom
Conversation
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 0503e01
☁️ Nx Cloud last updated this comment at |
288eee6 to
0dd3bf1
Compare
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:
We determined this CI failure is unrelated to our changes. The maven-batch-runner:package task fails due to a missing target/generated-sources/annotations directory in the maven4-adapter module — a pre-existing build infrastructure issue where the annotation processor is not generating the expected sources. Our PR only touches the Jest plugin and documentation, so this failure requires an environment-level fix independent of this PR.
No code changes were suggested for this issue.
Trigger a rerun:
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
🎓 Learn more about Self-Healing CI on nx.dev
Resolve all Jest config properties that reference files as task inputs, matching Jest's actual merge semantics (replaced, concatenated, deep merged). Handle runner `jest-runner-` and watchPlugins `jest-watch-` prefix resolution. Normalize Windows paths in resolved inputs. Add a `useJestResolver` option to control whether jest-resolve is used for input resolution, decoupled from `disableJestRuntime`.
…vedPath Fixes false positive when directory names start with 'node_modules' but aren't actual node_modules directories.
Current Behavior
The Jest plugin infers
testtarget inputs from the preset file path but ignores other config properties that reference files — transforms, setup files, module name mappers, reporters, watch plugins, etc. Changes to those files don't invalidate the test cache.Expected Behavior
All Jest config properties that reference files are resolved and included as task inputs, matching Jest's merge semantics:
resolver,globalSetup,globalTeardown,snapshotResolver,snapshotSerializers,testResultsProcessor,runner,reporters,watchPluginssetupFiles,setupFilesAfterEnvmoduleNameMapper,transformAlso handles
jest-runner-/jest-watch-prefix resolution,<rootDir>in preset values, and Windows path normalization.Adds a
useJestResolveroption to control whether jest-resolve is used for input resolution, decoupled fromdisableJestRuntime. By default, inputs are resolved using path-based classification (fast, no filesystem calls beyond what's already done). WhenuseJestResolveris enabled, jest-resolve is used instead, which follows symlinks and honors custommoduleDirectories/modulePaths— more accurate for workspace-linked packages but slower due to filesystem probing per resolved path.