Skip to content

Commit d9d8a3c

Browse files
benchmark: make clean build every time (#2294)
Caching build resulted in buggy behaviour when updating node version
1 parent 24cfc47 commit d9d8a3c

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

resources/benchmark.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ function LOCAL_DIR(...paths) {
3030
return path.join(__dirname, '..', ...paths);
3131
}
3232

33-
function TEMP_DIR(...paths) {
34-
return path.join(os.tmpdir(), 'graphql-js-benchmark', ...paths);
35-
}
36-
3733
// Build a benchmarkable environment for the given revision
3834
// and returns path to its 'dist' directory.
3935
function prepareRevision(revision) {
@@ -43,19 +39,16 @@ function prepareRevision(revision) {
4339
return babelBuild(LOCAL_DIR());
4440
}
4541

46-
if (!fs.existsSync(TEMP_DIR())) {
47-
fs.mkdirSync(TEMP_DIR());
48-
}
49-
5042
// Returns the complete git hash for a given git revision reference.
5143
const hash = exec(`git rev-parse "${revision}"`);
52-
const dir = TEMP_DIR(hash);
5344

54-
if (!fs.existsSync(dir)) {
55-
fs.mkdirSync(dir);
56-
exec(`git archive "${hash}" | tar -xC "${dir}"`);
57-
exec('yarn install', { cwd: dir });
58-
}
45+
const dir = path.join(os.tmpdir(), 'graphql-js-benchmark', hash);
46+
rmdirRecursive(dir);
47+
mkdirRecursive(dir);
48+
49+
exec(`git archive "${hash}" | tar -xC "${dir}"`);
50+
exec('yarn install', { cwd: dir });
51+
5952
for (const file of findFiles(LOCAL_DIR('src'), '*/__tests__/*')) {
6053
const from = LOCAL_DIR('src', file);
6154
const to = path.join(dir, 'src', file);

0 commit comments

Comments
 (0)