Skip to content

Commit

Permalink
Re-introduce accidentally removed test
Browse files Browse the repository at this point in the history
  • Loading branch information
nied committed May 4, 2022
1 parent ec08cea commit b9cc145
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/cache.test.js
Expand Up @@ -156,6 +156,45 @@ test.serial.cb(
},
);

test.serial.cb(
"should output files to standard cache dir if set to true in query",
t => {
const config = Object.assign({}, globalConfig, {
output: {
path: t.context.directory,
},
module: {
rules: [
{
test: /\.jsx?/,
loader: babelLoader,
exclude: /node_modules/,
options: {
cacheDirectory: true,
presets: ["@babel/preset-env"],
},
},
],
},
});

webpack(config, (err, stats) => {
t.is(err, null);
t.deepEqual(stats.compilation.errors, []);
t.deepEqual(stats.compilation.warnings, []);

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

t.is(err, null);

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

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

0 comments on commit b9cc145

Please sign in to comment.