Skip to content
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

Nested jest presets #8714

Closed
entropitor opened this issue Jul 18, 2019 · 5 comments
Closed

Nested jest presets #8714

entropitor opened this issue Jul 18, 2019 · 5 comments

Comments

@entropitor
Copy link

🐛 Bug Report

When a preset itself defines another preset, that preset is ignored

To Reproduce

Create a preset depending on another preset

Expected behavior

Both presets are merged

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS 10.14.5
    CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
  Binaries:
    Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
@sormy
Copy link

sormy commented Jul 18, 2019

As a workaround:

jest-preset.js:

const childPreset = require("child-preset")

module.exports = Object.assign(childPreset, {
  // current preset stuff
})

@entropitor
Copy link
Author

It is working!

I had to do make a small tweak though:

const childPreset = require("child-preset/jest-preset.js")

module.exports = Object.assign(childPreset, {
  // current preset stuff
})

(It's possible you have to do .json instead of .js depending on the child preset you want to extend)

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 3, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants