-
-
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
Pass testEnvironmentOptions as part of globalConfig to globalSetup and globalTeardown. #9930
Comments
+1 |
+1 |
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. |
+1. Would still like to have this feature. Need to write another environment soon and this is still an issue. |
If you can send a PR I'd be happy to land it 👍 It doesn't always make sense though, and in Jest 28 people can add |
Hm... Do I miss something? Not a case with Jest 27, but as per docs // setup.js
module.exports = async function (globalConfig, projectConfig) {
console.log(projectConfig.testEnvironmentOptions); // It is here? Or do I miss something?
}; |
Hah, might be! 😅 Jest 28 is stock full of features |
Is there a way we can allow Jest eco adopters to add something to globalConfig? I need that to work on this POC thymikee/jest-preset-angular#1434 |
What is "something"? To add to global config, just use a preset. But you want to do something more? |
For my case, there are a few options to use at root level which
These options are only at root level which I can use to process stuffs before my custom transformer kicks in, see example at https://github.com/thymikee/jest-preset-angular/pull/1434/files#diff-362b3ce4fcd1ed90a581c4d383217c2aa6f5d88d6117a77d995becc239486b07R8 Currently, the option |
I still don't fully understand, but it seems separate from what this PR asks for (which is already implemented). Could you open up a new feature request? That said, we should have called Closing since |
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. |
🚀 Feature Proposal
I would like to be able to reference
testEnvironmentOptions
inside of scripts passed in toglobalSetup
(and teardown).Motivation
I am writing a custom environment.
I have some global setup that I would like to do like:
I want the parameters like
to be defined in the
jest.config.js
. They are already defined there for me as part of my testEnvironmentOptions for my webdriver test environment.But the scripts in
globalSetup
andglobalTeardown
don't have access to it.Example
See motivation.
Pitch
This is the simplest change I can think of to accomplish what I need. I want to publish my jest-webdriver-environment, but right now I get around the limitation stated above by making fake
projects
that contain the flags I want to pass, sinceprojects
properties are considered part of theglobalConfig
.Thank you for considering this.
The text was updated successfully, but these errors were encountered: