-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
add clearCache cli command #4430
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
Changes from 1 commit
3036f7e
7615c79
04b495d
d63c815
0a7a2c2
4595517
40efb06
a4b9ea6
613feca
82d01b3
2cc04eb
cf503fb
072428c
4680586
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- actually create directory with real test - check for directory, then delete - use rimraf.sync - remove temp var
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
| * | ||
| * This source code is licensed under the BSD-style license found in the | ||
| * LICENSE file in the root directory of this source tree. An additional grant | ||
| * of patent rights can be found in the PATENTS file in the same directory. | ||
| */ | ||
| 'use strict'; | ||
|
|
||
| test('stub', () => expect(1).toBe(1)); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "jest": { | ||
| "testEnvironment": "node" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,20 +70,11 @@ export const runCLI = async ( | |
| ); | ||
|
|
||
| if (argv.clearCache) { | ||
| let clearCacheError; | ||
|
|
||
| configs.map(config => { | ||
|
||
| rimraf(config.cacheDirectory, [], () => { | ||
| clearCacheError = true; | ||
| process.stderr.write(`Unable to clear ${config.cacheDirectory}\n`); | ||
| }); | ||
| rimraf.sync(config.cacheDirectory); | ||
| process.stdout.write(`Cleared ${config.cacheDirectory}\n`); | ||
| }); | ||
|
|
||
| if (clearCacheError) { | ||
| process.exit(1); | ||
| } | ||
|
|
||
| process.exit(0); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be able to clear the cache for certain project or all projects, right now it's only for the first one.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't sure how this worked: should I just map over the configs array?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup, should be fine |
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary, or copypasta? (Just asking, fine if needed 😄)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skipOnWindows? I assumed it was part of the test convention as I saw it everywhere. I can remove it if it isn't necessary.