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 15e3f5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 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,7 @@ const {
ArrayPrototypeForEach,
ArrayPrototypeJoin,
ArrayPrototypePush,
Date,
DatePrototypeToISOString,
ObjectEntries,
RegExpPrototypeSymbolReplace,
RegExpPrototypeSymbolSplit,
Expand Down Expand Up @@ -164,9 +164,9 @@ function jsToYaml(indent, name, value, seen) {

if (name != null) {
result += prefix;
if (value instanceof Date) {
if (internalBinding('types').isDate(value)) {
// YAML uses the ISO-8601 standard to express dates.
result += ' ' + value.toISOString();
result += ' ' + DatePrototypeToISOString(value);
}
result += '\n';
propsIndent += ' ';
Expand Down

0 comments on commit 15e3f5c

Please sign in to comment.