From c75f92c4e2827a8c69edbb7dd937df87142b2b29 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Thu, 14 Jan 2021 22:08:49 +0900 Subject: fix: align DOMException API to the spec and add web platform testing of it. (#9106) * fix: align DOMException API to the spec * test: fix test case 070_location * test(DOMException): disable "does not inherit from Error: class-side" test of WPT * test: remove test cases in deno codebase * docs: add note about skipped test --- cli/tests/070_location.ts | 2 +- cli/tests/unit/dom_exception_test.ts | 18 ------------------ cli/tests/unit/unit_tests.ts | 1 - cli/tests/wpt.jsonc | 16 ++++++++++++++++ 4 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 cli/tests/unit/dom_exception_test.ts (limited to 'cli/tests') diff --git a/cli/tests/070_location.ts b/cli/tests/070_location.ts index 62fd34af2..4eace257e 100644 --- a/cli/tests/070_location.ts +++ b/cli/tests/070_location.ts @@ -6,5 +6,5 @@ console.log(location); try { location.hostname = "bar"; } catch (error) { - console.log(error); + console.log(error.toString()); } diff --git a/cli/tests/unit/dom_exception_test.ts b/cli/tests/unit/dom_exception_test.ts deleted file mode 100644 index f6c69c36d..000000000 --- a/cli/tests/unit/dom_exception_test.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -import { assert, assertEquals, unitTest } from "./test_util.ts"; - -unitTest(function testDomError() { - const de = new DOMException("foo", "bar"); - assert(de); - assertEquals(de.message, "foo"); - assertEquals(de.name, "bar"); - assertEquals(de.code, 0); -}); - -unitTest(function testKnownDomException() { - const de = new DOMException("foo", "SyntaxError"); - assert(de); - assertEquals(de.message, "foo"); - assertEquals(de.name, "SyntaxError"); - assertEquals(de.code, 12); -}); diff --git a/cli/tests/unit/unit_tests.ts b/cli/tests/unit/unit_tests.ts index 7d00101d3..1e86650c3 100644 --- a/cli/tests/unit/unit_tests.ts +++ b/cli/tests/unit/unit_tests.ts @@ -17,7 +17,6 @@ import "./custom_event_test.ts"; import "./dir_test.ts"; import "./dispatch_minimal_test.ts"; import "./dispatch_json_test.ts"; -import "./dom_exception_test.ts"; import "./error_stack_test.ts"; import "./event_test.ts"; import "./event_target_test.ts"; diff --git a/cli/tests/wpt.jsonc b/cli/tests/wpt.jsonc index 29f3967ad..242338155 100644 --- a/cli/tests/wpt.jsonc +++ b/cli/tests/wpt.jsonc @@ -182,5 +182,21 @@ ], "WebCryptoApi": [ "getRandomValues" + ], + "WebIDL": [ + "ecmascript-binding/es-exceptions/DOMException-constants", + "ecmascript-binding/es-exceptions/DOMException-constructor-and-prototype", + "ecmascript-binding/es-exceptions/DOMException-constructor-behavior", + { + "name": "ecmascript-binding/es-exceptions/DOMException-custom-bindings", + "expectFail": [ + // TODO(kt3k): Enable this test. + // We can pass this test by using Object.setPrototypeOf(...) instead of + // class...extends, but that causes a problem in printing of uncaught + // DOMException. We might need to modify how to print uncaught error in + // `//core/error.rs`. + "does not inherit from Error: class-side" + ] + } ] } -- cgit v1.2.3