Skip to content

Commit

Permalink
tests: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanv committed Nov 3, 2020
1 parent cfcc803 commit 0c28bd5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/webpack-cli/lib/utils/flag-defaults.js
Expand Up @@ -5,8 +5,10 @@ const cacheDefaults = (finalConfig, parsedArgs, outputOptions) => {
if (hasCache && (parsedArgs.config || outputOptions.defaultConfig)) {
if (finalConfig.cache && finalConfig.cache.type === 'filesystem') {
cacheConfig.buildDependencies = {
config: parsedArgs.config || outputOptions.defaultConfig,
config: parsedArgs.config || [outputOptions.defaultConfig],
};
} else {
cacheConfig = finalConfig.cache;
}
return { cache: cacheConfig };
}
Expand Down
11 changes: 11 additions & 0 deletions test/core-flags/cache-flags.test.js
Expand Up @@ -118,6 +118,17 @@ describe('cache related flags from core', () => {
expect(exitCode).toEqual(0);
});

it('should assign cache build dependencies with default config', () => {
// TODO: Fix on windows
if (isWindows) return;
const { stderr, stdout, exitCode } = run(__dirname, ['--cache-type', 'filesystem']);
expect(stderr).toBeFalsy();
expect(stdout).toContain('buildDependencies');
expect(stdout).toContain(`'${path.join(__dirname, './webpack.config.js')}'`);
expect(stdout).toContain("type: 'filesystem'");
expect(exitCode).toEqual(0);
});

it('should assign cache build dependencies with merged configs', () => {
// TODO: Fix on windows
if (isWindows) return;
Expand Down

0 comments on commit 0c28bd5

Please sign in to comment.