Skip to content

Commit

Permalink
test_runner: use internal date check function
Browse files Browse the repository at this point in the history
This fixes an issue where a value could be `instanceof Date` without actually being a native date.

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
malthe and aduh95 committed Mar 1, 2024
1 parent 9323496 commit 7e10cde
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/internal/test_runner/reporter/tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const {
ArrayPrototypeForEach,
ArrayPrototypeJoin,
ArrayPrototypePush,
Date,
ObjectEntries,
RegExpPrototypeSymbolReplace,
RegExpPrototypeSymbolSplit,
Expand Down Expand Up @@ -164,9 +163,9 @@ function jsToYaml(indent, name, value, seen) {

if (name != null) {
result += prefix;
if (value instanceof Date) {
if (internalBindings('types').isDate(value)) {

Check failure on line 166 in lib/internal/test_runner/reporter/tap.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

'internalBindings' is not defined
// YAML uses the ISO-8601 standard to express dates.
result += ' ' + value.toISOString();
result += ' ' + DatePrototypeToISOString(value);

Check failure on line 168 in lib/internal/test_runner/reporter/tap.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

'DatePrototypeToISOString' is not defined
}
result += '\n';
propsIndent += ' ';
Expand Down

0 comments on commit 7e10cde

Please sign in to comment.