From b739c1dfb472455aa290fe797c1d3b97ddc5b2cf Mon Sep 17 00:00:00 2001 From: Nicholas Paun Date: Thu, 29 Oct 2026 07:39:46 +0000 Subject: [PATCH] Add WPT console tests Run the WPT console suite, which checks that console is a namespace object with the right class string and IDL shape, that it can log symbols and very large arrays, and that historical members are gone. 41 of 51 subtests pass, including all 28 idlharness subtests. The 10 expected failures are all in console-label-conversion: count, countReset, time, timeLog and timeEnd come from V8's builtin console, which doesn't convert object labels with toString() or rethrow errors thrown by that conversion. helper.js is omitted because discovery picks it up although it is not a test. Co-Authored-By: Claude Opus 5.5 --- src/wpt/BUILD.bazel | 6 ++++++ src/wpt/console-test.ts | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/wpt/console-test.ts diff --git a/src/wpt/BUILD.bazel b/src/wpt/BUILD.bazel index 91540e8ce0a..9aace1696f5 100644 --- a/src/wpt/BUILD.bazel +++ b/src/wpt/BUILD.bazel @@ -275,3 +275,9 @@ wpt_test( config = "FileAPI-test.ts", wpt_directory = "@wpt//:FileAPI@module", ) + +wpt_test( + name = "console", + config = "console-test.ts", + wpt_directory = "@wpt//:console@module", +) diff --git a/src/wpt/console-test.ts b/src/wpt/console-test.ts new file mode 100644 index 00000000000..e42f6a4f07d --- /dev/null +++ b/src/wpt/console-test.ts @@ -0,0 +1,34 @@ +// Copyright (c) 2017-2026 Cloudflare, Inc. +// Licensed under the Apache 2.0 license found in the LICENSE file or at: +// https://opensource.org/licenses/Apache-2.0 + +import { type TestRunnerConfig } from 'harness/harness'; + +export default { + 'console-is-a-namespace.any.js': {}, + 'console-label-conversion.any.js': { + comment: + 'count, countReset, time, timeLog and timeEnd come from the V8 builtin console, which does not convert object labels with toString() or rethrow conversion errors', + expectedFailures: [ + "console.count()'s label gets converted to string via label.toString() when label is an object", + 'console.count() throws exceptions generated by erroneous label.toString() conversion', + "console.countReset()'s label gets converted to string via label.toString() when label is an object", + 'console.countReset() throws exceptions generated by erroneous label.toString() conversion', + "console.time()'s label gets converted to string via label.toString() when label is an object", + 'console.time() throws exceptions generated by erroneous label.toString() conversion', + "console.timeLog()'s label gets converted to string via label.toString() when label is an object", + 'console.timeLog() throws exceptions generated by erroneous label.toString() conversion', + "console.timeEnd()'s label gets converted to string via label.toString() when label is an object", + 'console.timeEnd() throws exceptions generated by erroneous label.toString() conversion', + ], + }, + 'console-log-large-array.any.js': {}, + 'console-log-symbol.any.js': {}, + 'console-namespace-object-class-string.any.js': {}, + 'console-tests-historical.any.js': {}, + 'helper.js': { + comment: 'Helper file picked up by discovery, not a test', + omittedTests: true, + }, + 'idlharness.any.js': {}, +} satisfies TestRunnerConfig;