Skip to content

Commit d998263

Browse files
committed
fix: handle spaced temp paths in test examples
1 parent a500324 commit d998263

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

scripts/__tests__/test-examples.test.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ let greeting = "hello"
1414
\`\`\`
1515
`,
1616
) => {
17-
let root = fs.mkdtempSync(path.join(os.tmpdir(), "test-examples-"));
17+
let root = fs.mkdtempSync(path.join(os.tmpdir(), "test examples-"));
1818
let docsRoot = path.join(root, "markdown-pages", "docs");
19-
let tempRoot = path.join(root, "temp");
19+
let tempRoot = path.join(root, "temp workspace");
2020
let file = path.join(docsRoot, "manual", "sample.mdx");
2121

2222
fs.mkdirSync(path.dirname(file), { recursive: true });
@@ -47,6 +47,7 @@ test("run compiles a real example block from an injected workspace", () => {
4747

4848
assert.equal(result.success, true);
4949
assert.equal(result.warningCount, 0);
50+
assert.ok(tempRoot.includes(" "));
5051
assert.ok(logs.some((log) => log.includes("testing examples in")));
5152
assert.match(
5253
fs.readFileSync(path.join(tempRoot, "src", "_tempFile.res"), "utf-8"),

scripts/test-examples.mjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,14 @@ export let run = ({
101101
fs.writeFileSync(path.join(tempRoot, "src", "_tempFile.res"), parsedResult);
102102
try {
103103
logger.log("testing examples in", file);
104-
child_process.execSync(`npm exec rescript build ${tempRoot} -- --quiet`, {
105-
cwd: projectRoot,
106-
stdio: "inherit",
107-
});
104+
child_process.execFileSync(
105+
"npm",
106+
["exec", "rescript", "build", tempRoot, "--", "--quiet"],
107+
{
108+
cwd: projectRoot,
109+
stdio: "inherit",
110+
},
111+
);
108112
} catch {
109113
success = false;
110114
}

0 commit comments

Comments
 (0)