Skip to content

Commit 15e3f5c

Browse files
maltheaduh95
andcommitted
test_runner: use internal date check function
This fixes an issue where a value could be `instanceof Date` without actually being a native date. Co-authored-by: Antoine du Hamel <[email protected]>
1 parent 9323496 commit 15e3f5c

File tree

1 file changed

+3
-3
lines changed
  • lib/internal/test_runner/reporter

1 file changed

+3
-3
lines changed

lib/internal/test_runner/reporter/tap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const {
33
ArrayPrototypeForEach,
44
ArrayPrototypeJoin,
55
ArrayPrototypePush,
6-
Date,
6+
DatePrototypeToISOString,
77
ObjectEntries,
88
RegExpPrototypeSymbolReplace,
99
RegExpPrototypeSymbolSplit,
@@ -164,9 +164,9 @@ function jsToYaml(indent, name, value, seen) {
164164

165165
if (name != null) {
166166
result += prefix;
167-
if (value instanceof Date) {
167+
if (internalBinding('types').isDate(value)) {
168168
// YAML uses the ISO-8601 standard to express dates.
169-
result += ' ' + value.toISOString();
169+
result += ' ' + DatePrototypeToISOString(value);
170170
}
171171
result += '\n';
172172
propsIndent += ' ';

0 commit comments

Comments
 (0)