question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

config.presets as an array

See original GitHub issue

🚀 Feature Proposal

Allow jest configuration file to include an array of presets, on top of a module/file path.

Motivation

When adding multiple presets, the only solution we have is messy: deep concatenation of properties.

Example

export default {
  preset: ["ts-node", "webdriverio"]
}

Pitch

This deserves to make it into the core because it goes alongside what jest does well in its’ configuration: intuitive customisability. We support other properties like projects, so I think that this deserves the same level of concern.

Out of Scope

Jest is awesome, it feels very good to use!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
waynevansoncommented, Aug 14, 2021

@sigveio I would say that documentation is the better alternative. I think you’re right, it’s a bit complicated.

Would you be happy a more polished version of this below?


A preset is a jest configuration, so feel free to import and merge it into to create custom configurations. This is useful when there are multiple presets, and provides flexibility if there are conflicts between common properties (ie Multiple Reporters or Transformers).

With ts-node and cjs examples.

import { default as TsJest } from "ts-jest"

export default {
  ...TsJest,
  // ... other configuration
}
0reactions
github-actions[bot]commented, Oct 14, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Presets - Babel.js
Babel presets can act as sharable set of Babel plugins and/or config ... This is added to the presets config option, which takes...
Read more >
Preset an array - Stack Overflow
I set up an array[8] to store a string conversion. The X will range from 0 to 255. If X is less than...
Read more >
Presets - Tailwind CSS
The presets option is an array and can accept multiple presets. This is useful if you want to split your reusable customizations up...
Read more >
Presets - IBM
Array configuration presets are used to configure all available drives in an array, based on the recommended values for the RAID level and...
Read more >
cannot use 'stats' config presets when exporting an array of configs ...
What is the expected behavior? as the documentation says, presets should be allowed. The website is documenting 2.1, but I'm assuming this is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found