fix(jest): suppress warning when jest config is provided inline in angular.json (fixes #1102)#2213
Open
fix(jest): suppress warning when jest config is provided inline in angular.json (fixes #1102)#2213
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
'jest.config.js'tonullCustomConfigResolver.resolveForProject()to accept optional config (config?: string | JestConfig)undefinedornullTesting
Related Issues
Fixes #1102