Skip to content

Commit a0c1ced

Browse files
Trottcodebytere
authored andcommitted
util: throw if unreachable TypedArray checking code is reached
If a comparison code path that is supposed to be unreachable is reached, throw. Add a c8 comment to ignore coverage for the line, as it should be unreachable. PR-URL: #31737 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 7b9d6d0 commit a0c1ced

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/internal/util/comparisons.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ function isIdenticalTypedArrayType(a, b) {
147147
return check(b);
148148
}
149149
}
150-
return false;
150+
/* c8 ignore next */
151+
assert.fail(
152+
`Unknown TypedArray type checking ${a[SymbolToStringTag]} ${a}\n` +
153+
`and ${b[SymbolToStringTag]} ${b}`
154+
);
151155
}
152156

153157
// Notes: Type tags are historical [[Class]] properties that can be set by

0 commit comments

Comments
 (0)