Skip to content

Commit

Permalink
util: throw if unreachable TypedArray checking code is reached
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and codebytere committed Feb 17, 2020
1 parent 7b9d6d0 commit a0c1ced
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ function isIdenticalTypedArrayType(a, b) {
return check(b);
}
}
return false;
/* c8 ignore next */
assert.fail(
`Unknown TypedArray type checking ${a[SymbolToStringTag]} ${a}\n` +
`and ${b[SymbolToStringTag]} ${b}`
);
}

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

0 comments on commit a0c1ced

Please sign in to comment.