Skip to content

Commit a890c1b

Browse files
43081jfabiospampinato
authored andcommitted
Test: added support for asserting fixture paths, accounting for fixture the cloning
1 parent f8dc396 commit a890c1b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/utils.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,23 @@ async function runCommand(dir, args, options) {
131131

132132
await fixtures?.dispose();
133133

134-
return { status, stdout, stderr, write };
134+
return { cwd, status, stdout, stderr, write };
135135
}
136136

137137
async function runTest(name, expected, getResult, options) {
138138
const title = options.title || "";
139139
test(`${title}(${name})`, async () => {
140-
const result = await getResult();
141-
const value = result[name];
140+
let result = await getResult();
141+
let value = result[name];
142142
if (expected !== undefined) {
143143
if (name === "status" && expected === "non-zero") {
144144
expect(value).not.toBe(0);
145145
} else if (typeof expected === "function") {
146146
expected(value);
147147
} else {
148+
if (typeof value === "string") {
149+
value = value.replaceAll(result.cwd, "$CWD");
150+
}
148151
expect(value).toEqual(expected);
149152
}
150153
} else {

0 commit comments

Comments
 (0)