Fix: Allow overriding Jest configuration in createJestStencilPreset function#7
Merged
johnjenkins merged 1 commit intostenciljs:mainfrom Dec 30, 2025
Conversation
9cbe4eb to
b21e181
Compare
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.
Hi, firstly thanks for supporting jest-30 in stenciljs. Currently I experimenting a problem as: CreateJestStencilPreset function doesn't respect custom options, which passed as parameter. So I created a pull request regarding to problem. I also created a minimal reproduction repo and linked it in the below
Fixes: #8
Description:
This PR updates
createJestStencilPresetto accept and merge user-provided Jest configuration options.Previously, the function ignored most options passed to it. Now, it spreads the provided options into the returned preset.
Additionally, logic has been added to handle
testMatchandtestRegex. If the user provides either of these options, the defaulttestRegexis omitted to prevent Jest configuration conflicts (since Jest does not allow bothtestMatchandtestRegexto be defined simultaneously).Motivation:
Users were unable to customize the Jest configuration (e.g., changing
testMatchpatterns) as documented in the README. So when a user needs to use jsdom for .ts files, and stencilPreset for .tsx files, they were unable to do that unless they add /* jsdom */ to on top of each test fileYou can reproduce the problem in the demo-repository: https://github.com/OzanAlpay/jest-stencil-runner-repro, by simply running
npm run installand thennpm run testcommands. I modify the example-test files in the original repository to create failing test cases.