jestjs / jest

Delightful JavaScript Testing.
https://jestjs.io
MIT License
44.28k stars 6.47k forks source link

[Feature]: config.ci option #15251

Closed anthony-hayes closed 2 months ago

anthony-hayes commented 3 months ago

🚀 Feature Proposal

Have a setting for the --ci flag in jest config files

Motivation

I'd like to use a single test script for both local and ci, and enable jest's --ci mode when CI=true (i.e. I'm running in CI such as GitHub actions)

I'm happy to do this env var check in the jest.config.js, but there's no way to set the ci mode from the config file: https://jestjs.io/docs/configuration

This is important for me when working with a monorepo, to avoid duplicated scripts in many package.json files to allow bulk running of tests with something like turbo run test and to avoid forcing folks to add a test:ci script to every package.json

Example

No response

Pitch

For flexibility, command line options should have a corresponding config file setting

github-actions[bot] commented 2 months ago

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

anthony-hayes commented 2 months ago

Looks like the --ci option isn't needed in new versions of jest, as updating snapshots is opt-in. Closing this

github-actions[bot] commented 1 month ago

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.