-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Add ability to pass config to presets #4200
Labels
Comments
You can use https://github.com/kulshekhar/ts-jest/blob/main/src/presets/create-jest-preset.ts. For example
Documentation doesn't mention about it so I think we can update documentation to reflect this request. |
This feature is now available under https://kulshekhar.github.io/ts-jest/docs/getting-started/presets#advanced The documentation is not yet nice so any suggestions are welcome. Thanks :) |
Vylpes
pushed a commit
to Vylpes/random-bunny
that referenced
this issue
Aug 7, 2024
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-jest](https://kulshekhar.github.io/ts-jest) ([source](https://github.com/kulshekhar/ts-jest)) | devDependencies | minor | [`29.1.2` -> `29.2.3`](https://renovatebot.com/diffs/npm/ts-jest/29.1.2/29.2.3) | --- ### Release Notes <details> <summary>kulshekhar/ts-jest (ts-jest)</summary> ### [`v29.2.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2923-2024-07-18) [Compare Source](kulshekhar/ts-jest@v29.2.2...v29.2.3) ### [`v29.2.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2922-2024-07-10) [Compare Source](kulshekhar/ts-jest@v29.2.1...v29.2.2) ### [`v29.2.1`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2921-2024-07-10) [Compare Source](kulshekhar/ts-jest@v29.2.0...v29.2.1) ### [`v29.2.0`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2920-2024-07-08) [Compare Source](kulshekhar/ts-jest@v29.1.5...v29.2.0) ##### Bug Fixes - fix: don't show warning message with Node16/NodeNext ([99c4f49](kulshekhar/ts-jest@99c4f49)), closes [#​4266](kulshekhar/ts-jest#4266) ##### Features - feat(cli): allow migrating cjs `presets` to `transform` config ([22fb027](kulshekhar/ts-jest@22fb027)) - feat(presets): add util functions to create ESM presets ([06f78ed](kulshekhar/ts-jest@06f78ed)), close [#​4200](kulshekhar/ts-jest#4200) - feat(presets): add util functions to create CJS presets ([f9cc3c0](kulshekhar/ts-jest@f9cc3c0)), close [#​4200](kulshekhar/ts-jest#4200) ##### Code refactoring - refactor: replace lodash deps with native js implementation ([40f1708](kulshekhar/ts-jest@40f1708)) - refactor: use `TsJestTransformerOptions` type everywhere possibly ([7d001be](kulshekhar/ts-jest@7d001be)) - refactor(cli): use new preset util functions to initialize test config ([c2b56ca](kulshekhar/ts-jest@c2b56ca)) - refactor(presets): use create preset util functions for cjs presets ([922d6d0](kulshekhar/ts-jest@922d6d0)) - test: switch `react-app` to use Vite ([827c8ad](kulshekhar/ts-jest@827c8ad)) ### [`v29.1.5`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2915-2024-06-16) [Compare Source](kulshekhar/ts-jest@v29.1.4...v29.1.5) ### [`v29.1.4`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2914-2024-05-28) [Compare Source](kulshekhar/ts-jest@v29.1.3...v29.1.4) ### [`v29.1.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2913-2024-05-21) [Compare Source](kulshekhar/ts-jest@v29.1.2...v29.1.3) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy40MzEuNCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AifQ==--> Reviewed-on: https://git.vylpes.xyz/RabbitLabs/random-bunny/pulls/178 Reviewed-by: Vylpes <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
Vylpes
pushed a commit
to Vylpes/card-drop
that referenced
this issue
Aug 12, 2024
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-jest](https://kulshekhar.github.io/ts-jest) ([source](https://github.com/kulshekhar/ts-jest)) | dependencies | minor | [`29.1.5` -> `29.2.4`](https://renovatebot.com/diffs/npm/ts-jest/29.1.5/29.2.4) | --- ### Release Notes <details> <summary>kulshekhar/ts-jest (ts-jest)</summary> ### [`v29.2.4`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2924-2024-08-01) [Compare Source](kulshekhar/ts-jest@v29.2.3...v29.2.4) ### [`v29.2.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2923-2024-07-18) [Compare Source](kulshekhar/ts-jest@v29.2.2...v29.2.3) ### [`v29.2.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2922-2024-07-10) [Compare Source](kulshekhar/ts-jest@v29.2.1...v29.2.2) ### [`v29.2.1`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2921-2024-07-10) [Compare Source](kulshekhar/ts-jest@v29.2.0...v29.2.1) ### [`v29.2.0`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2920-2024-07-08) [Compare Source](kulshekhar/ts-jest@v29.1.5...v29.2.0) ##### Bug Fixes - fix: don't show warning message with Node16/NodeNext ([99c4f49](kulshekhar/ts-jest@99c4f49)), closes [#​4266](kulshekhar/ts-jest#4266) ##### Features - feat(cli): allow migrating cjs `presets` to `transform` config ([22fb027](kulshekhar/ts-jest@22fb027)) - feat(presets): add util functions to create ESM presets ([06f78ed](kulshekhar/ts-jest@06f78ed)), close [#​4200](kulshekhar/ts-jest#4200) - feat(presets): add util functions to create CJS presets ([f9cc3c0](kulshekhar/ts-jest@f9cc3c0)), close [#​4200](kulshekhar/ts-jest#4200) ##### Code refactoring - refactor: replace lodash deps with native js implementation ([40f1708](kulshekhar/ts-jest@40f1708)) - refactor: use `TsJestTransformerOptions` type everywhere possibly ([7d001be](kulshekhar/ts-jest@7d001be)) - refactor(cli): use new preset util functions to initialize test config ([c2b56ca](kulshekhar/ts-jest@c2b56ca)) - refactor(presets): use create preset util functions for cjs presets ([922d6d0](kulshekhar/ts-jest@922d6d0)) - test: switch `react-app` to use Vite ([827c8ad](kulshekhar/ts-jest@827c8ad)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==--> Reviewed-on: https://git.vylpes.xyz/External/card-drop/pulls/336 Reviewed-by: Vylpes <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🚀 Feature Proposal
With v29 deprecating
ts-jest
inglobals
, it's now nearly impossible to both use a preset and pass options. Presets are just recipes and extending them should be trivial. To pass options, we currently would have to copy the recipe (which mostly defeats the purpose), and then add our custom options, or do some crazy remapping of the preset values, adding our config that way.It's actually pretty surprising to me that this was released with no way to extend presets, and the docs have both a page for Presets and a page for Options, and the two cannot be made to work together.
This could be accommodated by add a
withOptions
function on each preset that's basically a factory for creating the preset with the options merged in.If there's a better way, I'd love to hear it. Thank you.
Motivation
My motivation is to make it trivial to add options to presets, thereby making them useful again in cases where a
tsconfig
path or some other option needs to be adjusted.Example
No response
The text was updated successfully, but these errors were encountered: