Skip to content

Commit 35b9684

Browse files
Added support for the "$CWD" template variable in tests, in preparation for copy-based parallelization
1 parent f4f4011 commit 35b9684

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

test/__tests__/ignore-absolute-path.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { runCli } from "../utils";
44

55
describe("support absolute filename", () => {
66
runCli("ignore-absolute-path", [
7-
path.resolve(dirname(import.meta.url), "../__fixtures__/ignore-absolute-path/ignored/module.js"),
8-
path.resolve(dirname(import.meta.url), "../__fixtures__/ignore-absolute-path/depth1/ignored/*.js"),
9-
path.resolve(dirname(import.meta.url), "../__fixtures__/ignore-absolute-path/regular-module.js"),
7+
"$CWD/ignored/module.js",
8+
"$CWD/depth1/ignored/*.js",
9+
"$CWD/regular-module.js",
1010
"-l",
1111
]).test({
1212
status: 1,

test/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ function getNormalizedOutput(output, options) {
7777
async function runCommand(dir, args, options) {
7878
const cwd = getFixturesPath(dir);
7979
const archive = dir ? await getArchive(cwd) : undefined;
80-
const result = exec("node", [BIN_PATH, ...args], { cwd, stdio: "pipe" });
80+
const argsWithReplacements = args.map((arg) => arg.replaceAll("$CWD", cwd));
81+
const result = exec("node", [BIN_PATH, ...argsWithReplacements], { cwd, stdio: "pipe" });
8182

8283
if (options.input) {
8384
result.process.stdin.write(options.input);

0 commit comments

Comments
 (0)