Skip to content

Commit

Permalink
Add test for cacheDirectory=true in query
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Nov 7, 2016
1 parent f86507f commit 0425535
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,35 @@ test.cb.serial("should output <hash>.json.gz files to standard cache dir by defa
});
});

test.cb.serial("should output files to standard cache dir if set to true in query", (t) => {
const config = assign({}, globalConfig, {
output: {
path: t.context.directory,
},
module: {
loaders: [
{
test: /\.jsx?/,
loader: `${babelLoader}?cacheDirectory=true&presets[]=es2015`,
exclude: /node_modules/,
},
],
},
});

webpack(config, (err) => {
t.is(err, null);

fs.readdir(defaultCacheDir, (err, files) => {
files = files.filter((file) => /\b[0-9a-f]{5,40}\.json\.gzip\b/.test(file));

t.is(err, null);
t.true(files.length > 0);
t.end();
});
});
});

test.cb.skip("should read from cache directory if cached file exists", (t) => {
const config = assign({}, globalConfig, {
output: {
Expand Down

0 comments on commit 0425535

Please sign in to comment.