Skip to content

fix(jest): suppress warning when jest config is provided inline in angular.json (fixes #1102)#2213

Open
just-jeb wants to merge 1 commit intomasterfrom
fix/1102-no-warning-with-inline-config
Open

fix(jest): suppress warning when jest config is provided inline in angular.json (fixes #1102)#2213
just-jeb wants to merge 1 commit intomasterfrom
fix/1102-no-warning-with-inline-config

Conversation

@just-jeb
Copy link
Copy Markdown
Owner

@just-jeb just-jeb commented May 7, 2026

Description

When a Jest configuration is provided inline in angular.json, the builder was still showing a warning about missing jest.config.js file. This was because the schema had a default value of 'jest.config.js', which the resolver treated as an explicit request.

Root Cause

The CustomConfigResolver.resolveForProject() method always logged a warning when the config file didn't exist, regardless of whether the user explicitly requested it or if it was just the schema default.

Solution

  1. Changed schema default from 'jest.config.js' to null
  2. Updated CustomConfigResolver.resolveForProject() to accept optional config (config?: string | JestConfig)
  3. Return empty config object without warning when config is undefined or null
  4. Only warn when an explicit file path is requested but not found

Testing

  • All 37 unit tests for jest package pass
  • Added explicit tests to verify no warning is logged for undefined/null config

Related Issues

Fixes #1102

…gular.json

When jest configuration is provided inline in angular.json (rather than as a
separate jest.config.js file), the builder should not warn about the missing
jest.config.js file. This is expected behavior when users prefer inline config.

Changes:
- Changed schema.json default from 'jest.config.js' to null
- Updated CustomConfigResolver.resolveForProject to accept optional config
  and return empty config without warning when undefined/null
- Added test cases to verify no warning is logged for undefined/null config

Fixes #1102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Q: Why warning: unable to locate custom jest configuration file?

1 participant