fix(jest): suppress warning when jest config is provided inline in angular.json (fixes #1102)#2213
fix(jest): suppress warning when jest config is provided inline in angular.json (fixes #1102)#2213just-jeb wants to merge 2 commits into
Conversation
just-jeb
left a comment
There was a problem hiding this comment.
Need to double check that it actually fixes the related issue and addresses the comments.
| "singleQuote": true | ||
| }, | ||
| "packageManager": "yarn@3.8.7" | ||
| "packageManager": "yarn@4.14.1+sha512.64df448055b2d37ba269d7db535a469b8da93f8ef1140c25fd7a83c00a8fbaacb214ca0e02553b92a2c54cef78bb67d0b4817fab02001df0e24fac0faccc3b42" |
There was a problem hiding this comment.
Unclear why this change is here. Unrelated.
Status update on Jeb's reviewAddressing "Need to double check that it actually fixes the related issue and addresses the comments" The package.json inline comment ("Unclear why this change is here. Unrelated.") is now marked as outdated — the unrelated change was removed in a subsequent commit. The current diff contains only:
Does this fix issue #1102? Yes — the latest commenter's complaint was "Yet I still get the warning... And no option to disable the warning." With Is it breaking? No. The change only affects users who previously relied on the implicit PR is ready for merge. |
|
Correction to previous comment — I was wrong about Jest config discovery. When the builder passes config via Actual behavioral change:
The PR primarily fixes the spurious warning for users who provide no config file at all (inline angular.json config or purely builder-defaults). The narrow group affected by the behavioral change needs to add Recommendation: Add a note to the PR description documenting this migration path, but the breaking-change label seems unnecessary given the narrow impact and simple migration. |
…fault (fixes #1102) The warning 'unable to locate custom jest configuration file' was firing for projects that don't configure 'config' in angular.json. That's the default-discovery case — the user is allowed to keep their config in package.json, at workspace level, or as an inline JestConfig object. Only warn when the user explicitly pointed at a missing file.
4caecf9 to
4c9f64a
Compare
…json Adds a behavioral integration test that exercises the fix for #1102: when the 'config' option is an inline object (not a file path), tests must run and pass without the builder crashing or emitting the spurious "Custom Jest Config not found: [object Object]" warning. - Adds 'test-inline-config' architect target to examples/jest/simple-app using an inline Jest config object ({ testTimeout: 10000, verbose: true }) - Adds 'test:inline-config' script to example package.json - Adds 'config-inline-object' integration test entry to integration.js, using validate.js with --expect-suites=2 --expect-tests=4 to assert that all 4 tests in 2 suites actually run and pass - Extends validate.js with --run-script= to allow running any yarn script (not just 'test') while still validating Jest output
PR Checklist
PR Type
What is the current behavior?
Projects that don't set
configinangular.jsonrely on the schema defaultjest.config.js. When that file isn't present (because the user keeps their config inpackage.json, at workspace level, or as an inline JestConfig object), the builder logswarning: unable to locate custom jest configuration file at path …on every run. That's the default-discovery path — absence is normal, not user error. See #1102 (melroy892025-05-25 confirms it still fires on package.json-embedded configs).Issue Number: #1102
What is the new behavior?
The warning fires only when the configured path is not the schema default.
config: "jest.config.js"(the default) absent → silent.config: "my-custom-jest.config.ts"absent → still warns, because the user explicitly pointed at a file.Inline-object and inline-JSON-string configs are unchanged — they already short-circuit before the file-existence check (master, since #7bfe3123).
New unit test:
should NOT warn when the schema default jest.config.js is absent.Does this PR introduce a breaking change?
The warning text was advisory only; suppressing it for the default-discovery case doesn't change config resolution. Users who relied on the warning to detect a typo'd path still get it.
Other information
Branch was force-pushed to drop unrelated noise (commitlint downgrade, CHANGELOG entry removals, yarn.lock churn).