Skip to content

Fix: Allow overriding Jest configuration in createJestStencilPreset function#7

Merged
johnjenkins merged 1 commit intostenciljs:mainfrom
OzanAlpay:allow-override-jest-config
Dec 30, 2025
Merged

Fix: Allow overriding Jest configuration in createJestStencilPreset function#7
johnjenkins merged 1 commit intostenciljs:mainfrom
OzanAlpay:allow-override-jest-config

Conversation

@OzanAlpay
Copy link
Contributor

@OzanAlpay OzanAlpay commented Dec 29, 2025

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 createJestStencilPreset to 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 testMatch and testRegex. If the user provides either of these options, the default testRegex is omitted to prevent Jest configuration conflicts (since Jest does not allow both testMatch and testRegex to be defined simultaneously).

Motivation:
Users were unable to customize the Jest configuration (e.g., changing testMatch patterns) 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 file

You can reproduce the problem in the demo-repository: https://github.com/OzanAlpay/jest-stencil-runner-repro, by simply running npm run install and then npm run test commands. I modify the example-test files in the original repository to create failing test cases.

@OzanAlpay OzanAlpay force-pushed the allow-override-jest-config branch from 9cbe4eb to b21e181 Compare December 30, 2025 07:44
@johnjenkins johnjenkins merged commit 2364906 into stenciljs:main Dec 30, 2025
3 checks passed
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.

bug: createJestStencilPreset ignored user provided Jest configuration options

2 participants