Skip to content

Commit 965ea9f

Browse files
committed
chore: check the argument of custom matcher to be an array
1 parent ec5fa86 commit 965ea9f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/helpers/playwright-custom-expects.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ const { test, expect, mergeExpects } = require("@playwright/test");
66
// TODO: clean and refactor it, check with the team about bypassing the undefined
77
const toMatchSnapshotWithArray = expect.extend({
88
async toMatchSnapshotWithArray(received, name) {
9+
if (!Array.isArray(received)) {
10+
throw new Error("Expected argument to be an array.");
11+
}
12+
913
const assertionName = "toMatchSnapshotWithArray";
1014
let pass;
1115
let matcherResult;

0 commit comments

Comments
 (0)