diff --git a/benchmarkFixture.js b/benchmarkFixture.js index 7100b5f..dc85c31 100644 --- a/benchmarkFixture.js +++ b/benchmarkFixture.js @@ -406,6 +406,12 @@ export default async function benchmark (pm, fixture, opts) { if (err?.code !== 'ENOENT') throw err } } + // The cache dir may not exist right now: it was deleted two rows up, and + // a manager whose `node_modules` row is a registry-free no-op (pnpm + // restores the tree from the lockfile copy inside it) never recreated + // it. A symlink to a path that isn't there is dangling, and the warm-up + // install fails trying to mkdir its store through it. + await fs.mkdir(path.join(cwd, 'cache'), { recursive: true }) await fs.symlink(path.join(cwd, 'cache'), path.join(rewarmDir, 'cache'), 'dir') measureInstall(pm, rewarmDir, env) } finally { diff --git a/mergeResults.js b/mergeResults.js index b311b36..a40be88 100644 --- a/mergeResults.js +++ b/mergeResults.js @@ -47,7 +47,18 @@ async function main () { if (!samplesDir) { throw new Error('Usage: node mergeResults.js ') } - const runDirs = fs.readdirSync(samplesDir, { withFileTypes: true }) + // A samples directory that doesn't exist means no measuring job uploaded + // anything — every one of them failed. That is the same situation as an + // empty directory, and it deserves the same explanation rather than a raw + // ENOENT from `readdirSync`. + let entries + try { + entries = fs.readdirSync(samplesDir, { withFileTypes: true }) + } catch (err) { + if (err.code !== 'ENOENT') throw err + entries = [] + } + const runDirs = entries .filter((entry) => entry.isDirectory()) // Sorted so that a merge of the same runs always produces the same file, // whatever order the artifacts happened to be downloaded in.