-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use git node wpt to pull WPT into test/fixtures
This patch uses the `git node wpt` command in node-core-utils to initialize `test/fixtures/wpt` with a subset of the Web Platform Tests (https://github.com/web-platform-tests/wpt), including: - console tests - url tests - interfaces (.idl WebIDL files) - test harness located in `resources`, including the WebIDL parser Also initializes the README.md, LICENSE and versions.json in the `test/fixtures/wpt`. In later patches, we will use these files to run WPT and move away from the manually maintained copy-pasted files in `test/parallel/test-whatwg-*`. https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt PR-URL: #24035 Refs: #23192 Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
- Loading branch information
1 parent
566399e
commit 121a3f8
Showing
79 changed files
with
21,238 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Dual-License for W3C Test Suites | ||
|
||
All documents in this Repository are licensed by contributors to be distributed under both the [W3C Test Suite License](#w3c-test-suite-license) and the [W3C 3-clause BSD License](#w3c-3-clause-bsd-license), reproduced below. The choice of license is up to the licensee. For more information, see [Licenses for W3C Test Suites](https://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html) | ||
|
||
# W3C Test Suite License | ||
|
||
This document, Test Suites and other documents that link to this statement are provided by the copyright holders under the following license: By using and/or copying this document, or the W3C document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: | ||
|
||
Permission to copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use: | ||
|
||
* A link or URL to the original W3C document. | ||
* The pre-existing copyright notice of the original author, or if it doesn't exist, a notice (hypertext is preferred, but a textual representation is permitted) of the form: "Copyright © [$date-of-document] World Wide Web Consortium, (MIT, ERCIM, Keio, Beihang) and others. All Rights Reserved. http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html" | ||
* If it exists, the STATUS of the W3C document. | ||
|
||
When space permits, inclusion of the full text of this NOTICE should be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof. | ||
|
||
No right to create modifications or derivatives of W3C documents is granted pursuant to this license. However, if additional requirements (documented in the Copyright FAQ) are satisfied, the right to create modifications or derivatives is sometimes granted by the W3C to individuals complying with those requirements. | ||
|
||
If a Test Suite distinguishes the test harness (or, framework for navigation) and the actual tests, permission is given to remove or alter the harness or navigation if the Test Suite in question allows to do so. The tests themselves shall NOT be changed in any way. | ||
|
||
The name and trademarks of W3C and other copyright holders may NOT be used in advertising or publicity pertaining to this document or other documents that link to this statement without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders. Permission is given to use the trademarked string "W3C" within claims of performance concerning W3C Specifications or features described therein, and there only, if the test suite so authorizes. | ||
|
||
THIS WORK IS PROVIDED BY W3C, MIT, ERCIM, KEIO, BEIHANG, THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL W3C, MIT, ERCIM, KEIO, BEIHANG, THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
# W3C 3-clause BSD License | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of works must retain the original copyright notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the original copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
* Neither the name of the W3C nor the names of its contributors may be used to endorse or promote products derived from this work without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Web Platform Test Fixtures | ||
|
||
The files in this folder, including this document, | ||
are generated by [`git node wpt`][]. | ||
|
||
This folder contains a subset of the [Web Platform Tests][] for the | ||
implementation of Web APIs in Node.js. | ||
|
||
See [test/wpt](../../wpt/README.md) for information on how these tests are run. | ||
|
||
Last update: | ||
|
||
- resources: https://github.com/web-platform-tests/wpt/tree/679a364421/resources | ||
- interfaces: https://github.com/web-platform-tests/wpt/tree/db7f86289e/interfaces | ||
- console: https://github.com/web-platform-tests/wpt/tree/9786a4b131/console | ||
- url: https://github.com/web-platform-tests/wpt/tree/75b0f336c5/url | ||
|
||
[Web Platform Tests]: https://github.com/web-platform-tests/wpt | ||
[`git node wpt`]: https://github.com/nodejs/node-core-utils/blob/master/docs/git-node.md#git-node-wpt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
spec: https://console.spec.whatwg.org/ | ||
suggested_reviewers: | ||
- domenic | ||
- pwnall | ||
- domfarolino |
23 changes: 23 additions & 0 deletions
23
test/fixtures/wpt/console/console-count-logging-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Console Count - Logging Manual Test</title> | ||
<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com"> | ||
<meta name="assert" content="Console count method default parameter should work"> | ||
<link rel="help" href="https://console.spec.whatwg.org/#count"> | ||
</head> | ||
<body> | ||
<p>Open the console inside the developer tools. It should contain four entries whose contents are:</p> | ||
<p><code>default: 1</code></p> | ||
<p><code>default: 2</code></p> | ||
<p><code>default: 3</code></p> | ||
<p><code>default: 4</code></p> | ||
|
||
<script> | ||
console.count(); | ||
console.count(undefined); | ||
console.count("default"); | ||
console.count({toString() {return "default"}}); | ||
</script> | ||
</body> | ||
</html> |
47 changes: 47 additions & 0 deletions
47
test/fixtures/wpt/console/console-countReset-logging-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Console Count Reset - Logging Manual Test</title> | ||
<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com"> | ||
<meta name="assert" content="Console countReset method"> | ||
<link rel="help" href="https://console.spec.whatwg.org/#countreset"> | ||
</head> | ||
<body> | ||
<p>Open the console inside the developer tools. It should contain entries whose contents are:</p> | ||
<p><code>default: 1</code></p> | ||
<p><code>default: 1</code></p> | ||
<p><code>default: 1</code></p> | ||
<p><code>default: 1</code></p> | ||
<p><code>default: 1</code></p> | ||
<p><code>default: 1</code></p> | ||
<p><code>default: 1</code></p> | ||
<p><code>default: 1</code></p> | ||
<p><code>a label: 1</code></p> | ||
<p><code>a label: 1</code></p> | ||
<p style="color:grey;">[some warning message indicating that a count for label "b" does not exist]</p> | ||
|
||
<script> | ||
console.count(); | ||
console.countReset(); | ||
console.count(); | ||
|
||
console.count(undefined); | ||
console.countReset(undefined); | ||
console.count(undefined); | ||
|
||
console.count("default"); | ||
console.countReset("default"); | ||
console.count("default"); | ||
|
||
console.count({toString() {return "default"}}); | ||
console.countReset({toString() {return "default"}}); | ||
console.count({toString() {return "default"}}); | ||
|
||
console.count("a label"); | ||
console.countReset(); | ||
console.count("a label"); | ||
|
||
console.countReset("b"); // should produce a warning | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use strict"; | ||
// https://heycam.github.io/webidl/#es-namespaces | ||
// https://console.spec.whatwg.org/#console-namespace | ||
|
||
test(() => { | ||
assert_true(self.hasOwnProperty("console")); | ||
}, "console exists on the global object"); | ||
|
||
test(() => { | ||
const propDesc = Object.getOwnPropertyDescriptor(self, "console"); | ||
assert_equals(propDesc.writable, true, "must be writable"); | ||
assert_equals(propDesc.enumerable, false, "must not be enumerable"); | ||
assert_equals(propDesc.configurable, true, "must be configurable"); | ||
assert_equals(propDesc.value, console, "must have the right value"); | ||
}, "console has the right property descriptors"); | ||
|
||
test(() => { | ||
assert_false("Console" in self); | ||
}, "Console (uppercase, as if it were an interface) must not exist"); | ||
|
||
test(() => { | ||
const prototype1 = Object.getPrototypeOf(console); | ||
const prototype2 = Object.getPrototypeOf(prototype1); | ||
|
||
assert_equals(Object.getOwnPropertyNames(prototype1).length, 0, "The [[Prototype]] must have no properties"); | ||
assert_equals(prototype2, Object.prototype, "The [[Prototype]]'s [[Prototype]] must be %ObjectPrototype%"); | ||
}, "The prototype chain must be correct"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use strict"; | ||
// https://console.spec.whatwg/org/#counting | ||
// https://console.spec.whatwg/org/#timing | ||
|
||
const methods = ['count', 'countReset', 'time', 'timeLog', 'timeEnd']; | ||
|
||
for (const method of methods) { | ||
test(() => { | ||
let labelToStringCalled = false; | ||
|
||
console[method]({ | ||
toString() { | ||
labelToStringCalled = true; | ||
} | ||
}); | ||
|
||
assert_true(labelToStringCalled, `${method}() must call toString() on label when label is an object`); | ||
}, `console.${method}()'s label gets converted to string via label.toString() when label is an object`); | ||
|
||
test(() => { | ||
assert_throws({name: 'Error'}, () => { | ||
console[method]({ | ||
toString() { | ||
throw new Error('conversion error'); | ||
} | ||
}); | ||
}, `${method} must re-throw any exceptions thrown by label.toString() conversion`); | ||
}, `console.${method}() throws exceptions generated by erroneous label.toString() conversion`); | ||
} |
26 changes: 26 additions & 0 deletions
26
test/fixtures/wpt/console/console-number-format-specifiers-symbol-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Console Number Format Specifiers on Symbols</title> | ||
<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com"> | ||
<meta name="assert" content="Console format specifiers on Symbols"> | ||
<link rel="help" href="https://console.spec.whatwg.org/#formatter"> | ||
</head> | ||
<body> | ||
<p>Open the console inside the developer tools. It should contain 15 entries, each of which are:</p> | ||
<p><code>NaN</code></p> | ||
|
||
<script> | ||
const methods = ["log", "dirxml", "trace", "group", "groupCollapsed"]; | ||
|
||
for (method of methods) { | ||
console[method]("%i", Symbol.for("description")); | ||
if (method == "group" || method == "groupCollapsed") console.groupEnd(); | ||
console[method]("%d", Symbol.for("description")); | ||
if (method == "group" || method == "groupCollapsed") console.groupEnd(); | ||
console[method]("%f", Symbol.for("description")); | ||
if (method == "group" || method == "groupCollapsed") console.groupEnd(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
23 changes: 23 additions & 0 deletions
23
test/fixtures/wpt/console/console-string-format-specifier-symbol-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Console String Format Specifier on Symbols</title> | ||
<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com"> | ||
<meta name="assert" content="Console format specifiers on Symbols"> | ||
<link rel="help" href="https://console.spec.whatwg.org/#formatter"> | ||
</head> | ||
<body> | ||
<p>Open the console inside the developer tools. It should contain five entries, each of which are:</p> | ||
<p><code>Symbol(description)</code></p> | ||
|
||
<script> | ||
console.log("%s", Symbol.for("description")); | ||
console.dirxml("%s", Symbol.for("description")); | ||
console.trace("%s", Symbol.for("description")); | ||
console.group("%s", Symbol.for("description")); | ||
console.groupEnd(); | ||
console.groupCollapsed("%s", Symbol.for("description")); | ||
console.groupEnd(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* These tests assert the non-existence of certain | ||
* legacy Console methods that are not included in | ||
* the specification: http://console.spec.whatwg.org/ | ||
*/ | ||
|
||
"use strict"; | ||
|
||
test(() => { | ||
assert_equals(console.timeline, undefined, "console.timeline should be undefined"); | ||
}, "'timeline' function should not exist on the console object"); | ||
|
||
test(() => { | ||
assert_equals(console.timelineEnd, undefined, "console.timelineEnd should be undefined"); | ||
}, "'timelineEnd' function should not exist on the console object"); | ||
|
||
test(() => { | ||
assert_equals(console.markTimeline, undefined, "console.markTimeline should be undefined"); | ||
}, "'markTimeline' function should not exist on the console object"); |
70 changes: 70 additions & 0 deletions
70
test/fixtures/wpt/console/console-timing-logging-manual.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Console Timing Methods - Logging Manual Test</title> | ||
<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com"> | ||
<meta name="assert" content="Console timing methods"> | ||
<link rel="help" href="https://console.spec.whatwg.org/#timing"> | ||
</head> | ||
<body> | ||
<p>Open the console inside the developer tools. It should contain entries whose contents are:</p> | ||
<p><code>default: <some time></code></p> | ||
<p><code>default: <some time></code></p> | ||
|
||
<p><code>default: <some time></code></p> | ||
<p><code>default: <some time> extra data</code></p> | ||
<p><code>default: <some time></code></p> | ||
|
||
<p><code>default: <some time></code></p> | ||
<p><code>default: <some time> extra data</code></p> | ||
<p><code>default: <some time></code></p> | ||
|
||
<p><code>default: <some time></code></p> | ||
<p><code>default: <some time> extra data</code></p> | ||
<p><code>default: <some time></code></p> | ||
|
||
<p><code>custom toString(): <some time></code></p> | ||
<p><code>custom toString(): <some time> extra data</code></p> | ||
<p><code>custom toString(): <some time></code></p> | ||
|
||
<p><code>a label: <some time></code></p> | ||
<p><code>a label: <some time> extra data</code></p> | ||
<p><code>a label: <some time></code></p> | ||
|
||
<p style="color:grey;">[some warning message indicating that a timer for label "b" does not exist]</p> | ||
|
||
<script> | ||
console.time(); | ||
console.timeLog(); | ||
console.timeEnd(); | ||
|
||
console.time(undefined); | ||
console.timeLog(undefined); | ||
console.timeLog(undefined, "extra data"); | ||
console.timeEnd(undefined); | ||
|
||
console.time("default"); | ||
console.timeLog("default"); | ||
console.timeLog("default", "extra data"); | ||
console.timeEnd("default"); | ||
|
||
console.time({toString() {return "default"}}); | ||
console.timeLog({toString() {return "default"}}); | ||
console.timeLog({toString() {return "default"}}, "extra data"); | ||
console.timeEnd({toString() {return "default"}}); | ||
|
||
console.time({toString() {return "custom toString()"}}); | ||
console.timeLog({toString() {return "custom toString()"}}); | ||
console.timeLog({toString() {return "custom toString()"}}, "extra data"); | ||
console.timeEnd({toString() {return "custom toString()"}}); | ||
|
||
console.time("a label"); | ||
console.timeLog("a label"); | ||
console.timeLog("a label", "extra data"); | ||
console.timeEnd("a label"); | ||
|
||
console.timeLog("b"); // should produce a warning | ||
console.timeEnd("b"); // should produce a warning | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// META: script=/resources/WebIDLParser.js | ||
// META: script=/resources/idlharness.js | ||
|
||
// https://console.spec.whatwg.org/ | ||
|
||
idl_test( | ||
['console'], | ||
[] // no deps | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// GENERATED CONTENT - DO NOT EDIT | ||
// Content was automatically extracted by Reffy into reffy-reports | ||
// (https://github.com/tidoust/reffy-reports) | ||
// Source: Console Standard (https://console.spec.whatwg.org/) | ||
|
||
[Exposed=(Window,Worker,Worklet)] | ||
namespace console { // but see namespace object requirements below | ||
// Logging | ||
void assert(optional boolean condition = false, any... data); | ||
void clear(); | ||
void debug(any... data); | ||
void error(any... data); | ||
void info(any... data); | ||
void log(any... data); | ||
void table(any tabularData, optional sequence<DOMString> properties); | ||
void trace(any... data); | ||
void warn(any... data); | ||
void dir(any item, optional object? options); | ||
void dirxml(any... data); | ||
|
||
// Counting | ||
void count(optional DOMString label = "default"); | ||
void countReset(optional DOMString label = "default"); | ||
|
||
// Grouping | ||
void group(any... data); | ||
void groupCollapsed(any... data); | ||
void groupEnd(); | ||
|
||
// Timing | ||
void time(optional DOMString label = "default"); | ||
void timeLog(optional DOMString label = "default", any... data); | ||
void timeEnd(optional DOMString label = "default"); | ||
}; |
Oops, something went wrong.