Skip to content

Commit d491e60

Browse files
authored
Clear local baseline dir in hereby test (#1921)
1 parent 62fcda7 commit d491e60

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Herebyfile.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const { values: rawOptions } = parseArgs({
5757
tests: { type: "string", short: "t" },
5858
fix: { type: "boolean" },
5959
debug: { type: "boolean" },
60+
dirty: { type: "boolean" },
6061

6162
insiders: { type: "boolean" },
6263

@@ -325,6 +326,12 @@ function goTest(taskName) {
325326

326327
async function runTests() {
327328
warnIfTypeScriptSubmoduleNotCloned();
329+
330+
if (!options.dirty) {
331+
await rimraf(localBaseline);
332+
await fs.promises.mkdir(localBaseline, { recursive: true });
333+
}
334+
328335
await $test`${gotestsum("tests")} ./... ${isCI ? ["--timeout=45m"] : []}`;
329336
}
330337

@@ -520,10 +527,13 @@ function baselineAcceptTask(localBaseline, refBaseline) {
520527
};
521528
}
522529

530+
const localBaseline = "testdata/baselines/local/";
531+
const refBaseline = "testdata/baselines/reference/";
532+
523533
export const baselineAccept = task({
524534
name: "baseline-accept",
525535
description: "Makes the most recent test results the new baseline, overwriting the old baseline.",
526-
run: baselineAcceptTask("testdata/baselines/local/", "testdata/baselines/reference/"),
536+
run: baselineAcceptTask(localBaseline, refBaseline),
527537
});
528538

529539
/**

0 commit comments

Comments
 (0)