Ability to setup Env vars for running tests
See original GitHub issueIs this a bug report or a feature request?
🎁 Feature request
Version Info
N/A
How does one specify env vars for running tests? I have npm scripts setup to initialise env vars before running tests like these:
...
"scripts": {
"test": "better-npm-run test",
},
"betterScripts": {
"test": {
"command": "jest --coverage",
"env": {
"LOG_LEVEL": "silent",
"NODE_ENV": "test"
}
}
},
"jest" : { ... }
...
With majestic, I cannot set these in the UI since there is no such option and majestic seems to be not using the npm scripts.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Testing and Environment Variables - Thoughtbot
Learn how to test code using data in environment variables with Climate Control.
Read more >Ability to Configure Environment Variables for Unit Tests ...
I have an xUnit project which from the IDE I run using the Unit Tests window or the run configuration All tests from...
Read more >Allow to setup env variables specific to tests. #172 - GitHub
in my app i use Env var to select the configuration. So to select the correct configuration in the test i was looking...
Read more >Is it possible to set environment variables for exactly one test?
Here is the most common approach: describe('env', function () { var env; // mocking an environment before(function () { env = process.env; process.env...
Read more >Spring Boot : Integration tests with environment variables
Now that our code works, we want to write an integration test for EmailService. It can be done using GreenMail which creates a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is addressed with the rewrite. https://github.com/Raathigesh/majestic#optional-configuration
You could but then I see 2 issues with that:
possible duplication of props: you have to declare and maintain same set of vars in 2 places since most projects will have and continue to keep the option of running via CLI (my
betterScripts
is one such example)takes it further away from being zero-config
Most people have
npm test
oryarn test
configured to run in a certain way. By hooking into that (assuming you have a way of doing that), majestic, “instantly” becomes compatible with virtually every react project in the world. Zero config is the biggest selling point here - I’d suggest to keep it that way .Eventually, I do see the need of your own separate section but for this specific request, I wouldn’t go that way.