diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a3631a57ac8..ebbb28d19c4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * `[jest-util]` Fix `runOnlyPendingTimers` for `setTimeout` inside `setImmediate` ([#4608](https://github.com/facebook/jest/pull/4608)) ### Features +* `[jest-cli]` Add an option to clear the cache ([#4430](https://github.com/facebook/jest/pull/4430)) * `[babel-plugin-jest-hoist]` Improve error message, that the second argument of `jest.mock` must be an inline function ([#4593](https://github.com/facebook/jest/pull/4593)) * `[jest-snapshot]` [**BREAKING**] Concatenate name of test and snapshot ([#4460](https://github.com/facebook/jest/pull/4460)) * `[jest-cli]` Add an option to fail if no tests are found ([#3672](https://github.com/facebook/jest/pull/3672)) diff --git a/docs/CLI.md b/docs/CLI.md index 48d7c1484b6f..3527d04cfa91 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -79,12 +79,16 @@ Alias: `-b`. Exit the test suite immediately upon the first failing test suite. Whether to use the cache. Defaults to true. Disable the cache using `--no-cache`. *Note: the cache should only be disabled if you are experiencing caching related problems. On average, disabling the cache makes Jest at least two times slower.* -If you want to inspect or clear the cache, use `--showConfig` and look at the `cacheDirectory` value. +If you want to inspect the cache, use `--showConfig` and look at the `cacheDirectory` value. If you need to clear the cache, use `--clearCache`. ### `--ci` When this option is provided, Jest will assume it is running in a CI environment. This changes the behavior when a new snapshot is encountered. Instead of the regular behavior of storing a new snapshot automatically, it will fail the test and require Jest to be run with `--updateSnapshot`. +### `--clearCache` +##### available in Jest **21.3.0+** +Deletes the Jest cache directory and then exits without running tests. Will delete `cacheDirectory` if the option is passed, or Jest's default cache directory. The default cache directory can be found by calling `jest --showConfig`. *Note: clearing the cache will reduce performance.* + ### `--collectCoverageFrom=` Relative to the root directory, glob pattern matching the files that coverage info needs to be collected from.