[Bug]: Multiple `--projects` specified causes `--config` to not be used
Version
29.7.0
Steps to reproduce
- Clone my repro: https://github.com/AndrewSouthpaw/2023-10-jest-projects-bug-repro
yarnyarn jest --showConfigwith 2+projectsin the config shows the global config properly set (testTimeout: 30000), with projects listedyarn jest --projects=src/project1 --showConfigshows global config not set (notestTimeoutspecified)yarn jest --projects=src/project1 --showConfig -c jest.config.jsshows global config properly setyarn jest --projects=src/project1 src/project2 --showConfig -c jest.config.jsshows global config not set
This demonstrates the -c flag is ignored entirely when 2 or more projects are specified in --projects:
yarn jest --projects=src/project1 src/project2 --showConfig -c doesNotExist.config.jsdoes not erroryarn jest --projects=src/project1 --showConfig -c doesNotExist.config.jsdoes error, as expected
Project structure:
src
|__ project 1
|__ jest.config.js
|__ project 2
|__ jest.config.js
jest.config.js
Sample global jest.config.js:
const config = {
"projects": ["src/project1", "src/project2"],
"testTimeout": 30000,
}
module.exports = config
Expected behavior
When providing -c jest.config.js, it is used regardless of whether I provide 1 or 2+ projects under --projects
Actual behavior
-c flag is not used when --projects receives 2 or more arguments.
Additional context
No response
Environment
System:
OS: macOS 13.6
CPU: (10) arm64 Apple M1 Max
Binaries:
Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
Yarn: 3.2.4 - ~/.nvm/versions/node/v18.17.0/bin/yarn
npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
pnpm: 8.8.0 - ~/.nvm/versions/node/v18.17.0/bin/pnpm
npmPackages:
jest: ^29.7.0 => 29.7.0
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.
Still an issue.
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.
Still an issue
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.
Still an issue
-- Andrew Smith 971.219.3670 Code http://www.andrewsouthpaw.com/ | Dance http://www.andrewsmithdance.com/
On Wed, Jan 10, 2024 at 12:05 AM github-actions[bot] < @.***> wrote:
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.
— Reply to this email directly, view it on GitHub https://github.com/jestjs/jest/issues/14586#issuecomment-1884362500, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHSOTGK46FQNRCV2EXJAMLYNZDTFAVCNFSM6AAAAAA5OPQE2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBUGM3DENJQGA . You are receiving this because you authored the thread.Message ID: @.***>
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.
Still an issue
-- Sent from a tiny screen; please excuse brevity or errors, or both.
On Fri, Feb 9, 2024 at 08:04 github-actions[bot] @.***> wrote:
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.
— Reply to this email directly, view it on GitHub https://github.com/jestjs/jest/issues/14586#issuecomment-1936189995, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHSOTDR37GW6IOROGLA5U3YSZCJDAVCNFSM6AAAAAA5OPQE2WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWGE4DSOJZGU . You are receiving this because you authored the thread.Message ID: @.***>
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.
Still an issue
I'm always a bit confused by the differentiation of project and global config 😅 Specifically, testTimeout seems very much like a project config thing (e.g. integration tests should probably have a higher timeout than unit tests). Regardless, this is obviously a bug!
Would you be up for sending a PR?
Definitely would be up for it! At this point Jest seems like a pretty large project, if you have any pointers on where files to get started / where you think the problem is located, that would be most welcome. Otherwise I'll try to find time to start digging around at some point and see where I wind up.