-
-
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
Add runnerConfig
option to configure runners
#4278
Comments
@cpojer @aaronabramov If we do decide to move forward with this, what do you think should be the interface here? |
maybe something like what we do with reporters?
which translates to
and then
|
I actually had something quite different in mind because The challenge here is how to make this type safe and how to make the configuration system ultimately configurable. Most things in Jest would be typed with |
i'm a little worried about mixing Jest projectConfig with other custom configuration. I really don't like how it worked with global+project configs sharing the same JSON object, most of the bugs we discovered with MPR were super hard to debug and were caused by some values being in the wrong config. But i think if we have a separate typed |
The GlobalConfig + ProjectConfig issues were a one time cost that the split brought with it, and I think now (as of Jest 21), the system is working quite smoothly. The thing that worries me the most is adding an uncontrollable amount of config and cli options (it's already a bit of a mess) and making ProjectConfig something that is theoretically pluggable would counter that, as people could build their own runners that cut down on the number of configuration options. Also, to build runners for things like prettier/eslint etc., all the test related configuration options don't really make any sense. |
So is there still no way to pass custom options to a custom runner? |
Is anybody working on this? |
Nope, feel free to grab it :) |
I installed the dependencies and ran the tests, many of them break on windows, that needs to be solved first. |
We have appveyor running as CI, so developing on windows should be fine... You'll need mercurial installed for a few tests, but besides that you should be good |
It seams most tests are failing because somehow paths are being prepended with
|
That definitely sounds like an ideal solution, but I'm not sure how people would differentiate between project and global config. Do you imagine everything still being in a single flat configuration? Would it be possible at all to check for typos in configuration in Something like this would feel like boilerplate I think: {
"jest": {
// a bunch of global config,
"runners": [
// jest config
{
"module": "jest-runner",
"testMatch": ["blabla"]
},
// eslint config
{
"module": "jest-runner-eslint",
"include": ["blablabla"]
}
]
}
} But any other option feels like it'd just be confusing, which is worse. I do think @aaronabramov's first suggestion should be the way we go, at least for a first iteration. I do think to properly separate config we'll have to do a breaking change anyways, so why not design something properly at that point, but still solve the very real need of custom runner config with a simple tuple similar to reporters for now? That's also how we ended up passing config to watch plugins. Using cosmoconfig shouldn't be necessary. |
Just tried to write a runner and was surprised to find that this doesn't exist. I guess ones like I don't entirely understand the interaction between the project config and global config, so can't really comment intelligently on @aaronabramov's original suggestion (it looks like it would only support it in the global config, which isn't very useful if you're using one runner in one project and another in another, e.g. the default runner for tests in one project and the eslint runner for linting in another). Edit: added https://github.com/elyobo/jest-runner-oas-linter, just uses config in |
Still no solution? If anyway can guide me a bit from where we can start that would be great. Otherwise, we should use hacky solutions. And yes, there is a way. And yes, this should land in runners implementations that you want to use, until the official jest support comes. The solution is that runners should try to read from Why in I've tested that solution and it's great for now. I probably will fork the babel and eslint runners for now if they don't accept my PRs. |
Please don't contribute hacks to the runners. Either apply the patch locally or maybe spend this time to actually implement the feature in Jest. You can start with |
Yea, agree. Thanks for the starting point. |
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 30 days. |
bump |
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 30 days. |
bump |
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 30 days. |
bump |
Do you want to request a feature or report a bug?
Enhancement
What is the current behavior?
There is no way of configuring a test runner
What is the expected behavior?
It would be nice to have a way to configure runners. For example:
runnerConfig
which could be any arbitrary object that is relevant for the runner configuration.Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
The text was updated successfully, but these errors were encountered: