Skip to content

Commit b68734b

Browse files
joyeecheungBridgeAR
authored andcommitted
test: initialize test/wpt to run URL and console .js tests
This patch: - Creates a new test suite `wpt` that can be used to run a subset of Web Platform Tests - Adds a `WPTRunner` in `test/common/wpt.js` that can run the WPT subset in `test/fixtures/wpt` with a vm and the WPT harness while taking the status file in `test/wpt/status` into account. Here we use a new format of status file (in JSON) to handle specific requirements (like ICU requirements) in the tests and to handle expected failures and TODOs. - Adds documentation on how the runner and the update automation works - Runs the WHATWG URL tests and the console tests with the new test runner. With this patch we eliminates the need of copy-pasting with manual modifications to update a large chunk of our WPT subset previously maintained in `test/parallel`. Now the tests run in `test/wpt` can be automatically updated with `git node wpt` without modifications by the actual WPT harness instead of our home-grown mock. There are still a few URL tests left that need to be migrated in the upstream to be placed in .js instead of .html - we currently still use the legacy harness mock in the test files. PR-URL: #24035 Refs: #23192 Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent c973551 commit b68734b

16 files changed

+710
-14
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ test-debug: test-build
496496
test-message: test-build
497497
$(PYTHON) tools/test.py $(PARALLEL_ARGS) message
498498

499+
test-wpt: all
500+
$(PYTHON) tools/test.py $(PARALLEL_ARGS) wpt
501+
499502
test-simple: | cctest bench-addons-build # Depends on 'all'.
500503
$(PYTHON) tools/test.py $(PARALLEL_ARGS) parallel sequential
501504

test/common/README.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -772,12 +772,19 @@ Deletes and recreates the testing temporary directory.
772772

773773
## WPT Module
774774

775-
The wpt.js module is a port of parts of
776-
[W3C testharness.js](https://github.com/w3c/testharness.js) for testing the
777-
Node.js
778-
[WHATWG URL API](https://nodejs.org/api/url.html#url_the_whatwg_url_api)
779-
implementation with tests from
780-
[W3C Web Platform Tests](https://github.com/w3c/web-platform-tests).
775+
### harness
776+
777+
A legacy port of [Web Platform Tests][] harness.
778+
779+
See the source code for definitions. Please avoid using it in new
780+
code - the current usage of this port in tests is being migrated to
781+
the original WPT harness, see [the WPT tests README][].
782+
783+
### Class: WPTRunner
784+
785+
A driver class for running WPT with the WPT harness in a vm.
786+
787+
See [the WPT tests README][] for details.
781788

782789

783790
[&lt;Array>]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
@@ -792,3 +799,5 @@ implementation with tests from
792799
[`hijackstdio.hijackStdErr()`]: #hijackstderrlistener
793800
[`hijackstdio.hijackStdOut()`]: #hijackstdoutlistener
794801
[internationalization]: https://github.com/nodejs/node/wiki/Intl
802+
[Web Platform Tests]: https://github.com/web-platform-tests/wpt
803+
[the WPT tests README]: ../wpt/README.md

0 commit comments

Comments
 (0)