-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cache-folder config option for setting cache folder location (#2046)
* add cache-folder config option for setting cache folder * unit test for cache-folder config * test the priorities of different cache folder setting methods * run the cache config tests in sequence
- Loading branch information
1 parent
68df0ea
commit 8437487
Showing
3 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* @flow */ | ||
|
||
import type {CLIFunctionReturn} from '../../src/types.js'; | ||
import * as reporters from '../../src/reporters/index.js'; | ||
import * as configCmd from '../../src/cli/commands/config.js'; | ||
import {run as buildRun} from './_helpers.js'; | ||
import * as fs from '../../src/util/fs.js'; | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000; | ||
|
||
const runConfig = buildRun.bind( | ||
null, | ||
reporters.ConsoleReporter, | ||
'', | ||
(args, flags, config, reporter): CLIFunctionReturn => { | ||
return configCmd.run(config, reporter, flags, args); | ||
}, | ||
); | ||
|
||
test('write cache-folder config into .yarnrc file', (): Promise<void> => { | ||
return runConfig(['set', 'cache-folder', 'folder_dir_for_test'], {}, '', async (config) => { | ||
const configFile = await fs.readFile(config.registries.yarn.homeConfigLoc); | ||
expect(configFile).toContain('folder_dir_for_test'); | ||
}); | ||
}); | ||
|
||
test('cache-folder flag has higher priorities than .yarnrc file', (): Promise<void> => { | ||
return runConfig(['set', 'cache-folder', 'set_config_folder_dir'], {'cacheFolder': 'flag_config_folder_dir'}, | ||
'', (config) => { | ||
expect(config.cacheFolder).toContain('flag_config_folder_dir'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters