Skip to content

Commit 2b456de

Browse files
aspeddrofhammerschmidt
authored andcommitted
tests: clean up some tests to avoid build error with stale output (#7355)
1 parent ce3102f commit 2b456de

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

scripts/test.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,14 @@ if (runtimeDocstrings) {
143143
console.log("Running runtime docstrings tests");
144144

145145
const generated_mocha_test_res = path.join(
146-
"tests",
147-
"docstring_tests",
146+
docstringTestDir,
148147
"generated_mocha_test.res",
149148
);
150149

151-
// Remove `generated_mocha_test.res` if file exists
152-
if (fs.existsSync(generated_mocha_test_res)) {
153-
console.log(`Removing ${generated_mocha_test_res}`);
154-
fs.unlinkSync(generated_mocha_test_res);
155-
}
150+
await execClean([], {
151+
cwd: docstringTestDir,
152+
stdio: "inherit"
153+
})
156154

157155
await execBuild([], {
158156
cwd: docstringTestDir,
@@ -180,7 +178,7 @@ if (runtimeDocstrings) {
180178

181179
console.log("Run mocha test");
182180
await mocha(
183-
[path.join("tests", "docstring_tests", "generated_mocha_test.res.js")],
181+
[path.join(docstringTestDir, "generated_mocha_test.res.js")],
184182
{
185183
cwd: projectDir,
186184
stdio: "inherit",

tests/build_tests/jsx_settings_inheritance/input.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { setup } from "#dev/process";
44

5-
const { execBuild } = setup(import.meta.dirname);
5+
const { execBuild, execClean } = setup(import.meta.dirname);
66

7+
await execClean()
78
await execBuild();

tests/build_tests/transitive_pinned_dependency1/input.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import * as assert from "node:assert";
44
import { existsSync } from "node:fs";
55
import { setup } from "#dev/process";
66

7-
const { execBuild } = setup("./a");
7+
const { execBuild, execClean } = setup("./a");
8+
9+
await execClean()
810

911
const output = await execBuild();
1012
console.log(output);

tests/build_tests/transitive_pinned_dependency2/input.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import * as assert from "node:assert";
44
import { existsSync } from "node:fs";
55
import { setup } from "#dev/process";
66

7-
const { execBuild } = setup("./a");
8-
7+
const { execBuild, execClean } = setup("./a");
8+
await execClean()
99
const output = await execBuild();
1010
console.log(output);
1111

0 commit comments

Comments
 (0)