-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
--config [JSON] + projects doesn't seem to work #7415
Comments
Hey @benmvp thanks for filing! Confirmed - I'll take a look |
Awesome! Thanks @rickhanlonii! Lemme know if there's any way I can help |
Hey @benmvp, I took a look at this and it looks like the projects need to be specified as separate cli options as Can you try:
|
Hi @rickhanlonii thanks for getting back to me so quickly! So I thought I had a spark of brilliance yesterday and I tried moving the projects into JSON args but it doesn't work. They don't get parsed. When I did it, I tried it without the
When I run it with I've only gotten the |
I'm running into the same issue as @benmvp with the I'm in the same boat where I don't know exactly what this I'd be happy to send a PR, but I'm not 100% sure what should be the fix 😅 Additional context |
I have the same problem. When I use a serialized JSON for the --config option that contains projects, I also get the following error:
|
Hello, how is the progress? I'm specifying the config in the |
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. |
🐛 Bug Report
When passing serialized JSON for the
--config
option that contains projects, I get the following error:The parsed JSON looks like:
To Reproduce
Just run:
npx jest --config '{"projects":[{"moduleFileExtensions":["ts","js"],"transform":{"^.+\\.(ts|js)$":"babel-jest"},"testMatch":["<rootDir>/src/**/*.ts"],"runner":"jest-runner-tsc","displayName":"typescript"},{"moduleFileExtensions":["ts","js"],"transform":{"^.+\\.(ts|js)$":"babel-jest"},"testMatch":["<rootDir>/src/**/*.spec.ts"],"displayName":"test"}],"rootDir":"."}'
Expected behavior
I expect to be able to run the projects just like if they were defined in a config file (which does work).
Link to repl or repo (highly encouraged)
See repro command. Happy to contribute a PR, I just don't know what to fix. 😄
Run
npx envinfo --preset jest
Paste the results here:
Debugging
1/ I tried moving the JSON back to a
.js
file and it works (my current workaround). I need the contents to be dynamic, which is why I want to pass JSON2/ I did a whole bunch of code spelunking to try to get it to work. I narrowed down the problem to
readConfigs
injest-config
. It seems that after successfully parsing the JSON, it maps over each project toreadConfig
on each (passingconfigPath
). The problem is thatconfigPath
isnull
soreadConfig
complains. And the reasonconfigPath
isnull
is because when the JSON was originally parsed (also byreadConfig
), I guess there is noconfigPath
to set so it remainsnull
. That's as far as I got since I don't understand the why of the code.The text was updated successfully, but these errors were encountered: