What's The Difference Between '--watchAll=false' And 'CI=true'?
I'm setting up a CI using reactjs and I don't want the tests to run in watch mode.
In the documentation for running tests, it states the following:
"By default npm test runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called CI."
If, as stated, setting the 'CI=true':
"The test command will force Jest to run in CI-mode, and tests will only run once instead of launching the watcher."
Why does it (as quoted below) say For non-CI environments? Is there any reason you shouldn't use '--watchAll=false' in CI environments?
"For non-CI environments, you can simply pass the --watchAll=false flag to disable test-watching."
I've tried both in my CI environment and in my case both seems to work fine and doing the same thing. I would even prefer the '--watchAll=false', since this would be a more cross platform approach.
So, which one should I use in my CI environment and why? And also, what's the difference between the two of them?
Wondering which approach I should use 'CI=true' or '--watchAll=false'. I've tried both and they seem to be working in the same way.
Your CI environment will likely set the CI environment variable to true without you doing anything.
So for your CI you shouldn't really need to set either
CI=true but if you do want to set something manually rather use CI=true.
At least one difference between the 2 is that
watchAll=false (and if
CI=false) will still create Jest snapshots if they don't exist. You won't want this in a CI environment. Your tests will pass even if the snapshots change.
- → Import statement and Babel
- → should I choose reactjs+f7 or f7+vue.js?
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → .tsx webpack compile fails: Unexpected token <
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → React Native with visual studio 2015 IDE
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
- → How do I determine if a new ReactJS session and/or Browser session has started?
- → Alt @decorators in React-Native
- → How to dynamically add class to parent div of focused input field?