Skip to content

Commit 45ade4e

Browse files
claude: Fix argument positioning bug in test framework for keep-typ/keep-tex
Fixes a bug introduced in 49a1390, which added inputFile parameter support for finding kept intermediate files in project contexts. The original commit changed: verifyFns.push(verifyMap[key](outputFile.outputPath, ...value)); to: verifyFns.push(verifyMap[key](outputFile.outputPath, ...value, input)); This assumed value is always [matches, noMatches], but when tests only specify matches (no noMatches array), value is [matches] and input fills the noMatchesUntyped slot instead of inputFile, causing: "TypeError: noMatchesUntyped?.map is not a function" Fix by explicitly destructuring value into matches and noMatches, then passing inputFile in the correct position. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 02f4b1d commit 45ade4e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/smoke/smoke-all.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,11 @@ function resolveTestSpecs(
280280
// keep-typ/keep-tex files are alongside source, so pass input path
281281
const needsInputPath = key === "ensureTypstFileRegexMatches" || key === "ensureLatexFileRegexMatches";
282282
if (typeof value === "object" && Array.isArray(value)) {
283-
// Only use spread operator for arrays
284-
verifyFns.push(verifyMap[key](outputFile.outputPath, ...value, needsInputPath ? input : undefined));
283+
// value is [matches, noMatches?] - ensure inputFile goes in the right position
284+
const matches = value[0];
285+
const noMatches = value[1];
286+
const inputFile = needsInputPath ? input : undefined;
287+
verifyFns.push(verifyMap[key](outputFile.outputPath, matches, noMatches, inputFile));
285288
} else {
286289
verifyFns.push(verifyMap[key](outputFile.outputPath, value, undefined, needsInputPath ? input : undefined));
287290
}

0 commit comments

Comments
 (0)