Skip to content

Commit 261e514

Browse files
committed
support strings in ensureFileRegexMatches
1 parent 56da834 commit 261e514

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/verify.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,18 @@ export const ensureHtmlElements = (
180180

181181
export const ensureFileRegexMatches = (
182182
file: string,
183-
matches: RegExp[],
184-
noMatches?: RegExp[],
183+
matchesUntyped: (string | RegExp)[],
184+
noMatchesUntyped?: (string | RegExp)[],
185185
): Verify => {
186+
const asRegexp = (m: string | RegExp) => {
187+
if (typeof m === "string") {
188+
return new RegExp(m);
189+
} else {
190+
return m;
191+
}
192+
};
193+
const matches = matchesUntyped.map(asRegexp);
194+
const noMatches = noMatchesUntyped?.map(asRegexp);
186195
return {
187196
name: `Inspecting ${file} for Regex matches`,
188197
verify: async (_output: ExecuteOutput[]) => {

0 commit comments

Comments
 (0)