From a9d9b05fc974425089922bf66e8e7751ea8bfbbc Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 25 Aug 2021 12:52:13 -0700 Subject: [PATCH] chore(test): Avoid spurious failures packing node_modules/.cache --- test/create.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/create.js b/test/create.js index 83472f1d..c30aa286 100644 --- a/test/create.js +++ b/test/create.js @@ -154,7 +154,13 @@ t.test('gzipped tarball that makes some drain/resume stuff', t => { const cwd = path.dirname(__dirname) const out = path.resolve(dir, 'package.tgz') - c({ z: true, C: cwd }, ['node_modules']) + // don't include node_modules/.cache, since that gets written to + // by nyc during tests, and can result in spurious errors. + const entries = fs.readdirSync(`${cwd}/node_modules`) + .filter(e => !/^\./.test(e)) + .map(e => `node_modules/${e}`) + + c({ z: true, C: cwd }, entries) .pipe(fs.createWriteStream(out)) .on('finish', _ => { const child = spawn('tar', ['tf', out], {