-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate tests into ones that need dom and ones that don't #11277
Comments
I've been working on supporting tests that run in JavaScript shells. There's also #7174 about node. |
I'm supportive of this provided it does demonstrably benefit Node.js or any other such project. I can assist with reviews of this code. |
@Ms2ger what's that work look like? are you screening new tests? modifying old ones? is what you're doing already enough or do we need to do more? |
I'm currently working on the infrastructure on the SpiderMonkey side; will then move on to writing new tests for wasm. |
I believe we have the infrastructure necessary to support this. Are you familiar with WPT's "multi-global" tests? The WPT CLI interprets any JavaScript file with the suffix "Don't inherently require a DOM" may not be stringent enough, though. For instance, some tests load expectation data using |
@jugglinmike loading fixtures could either be mocked or i guess the condition i'm really looking for is "needs to run in html" or however that can be better said. |
I don't mean to mince words about the requirements, just wanted to make sure we didn't overlook other obstacles |
A still simpler solution for metadata would be to reformat the existing JSON files into JavaScript files that assigned the data to a global variable. The two downsides to this are that it makes dependencies implicit and that it would be easier for folks to do scripting within the fixture data (which I think we'd generally want to discourage). Still, when compared to the complexity of a new rule for test interpreting (i.e. @annevk how would you feel about adopting that pattern in the URL tests? @devsnek I've only been considering Node.js and the tests in |
@jugglinmike as node implements esm there is like a cascade of standards it might gain. if we want to support https imports as an example we'll need to add fetch and then response and blob and body and stream etc etc. aside from that in the last year or so there has been more and more of a push for it to support standards in general, like with Encoding and URL i'm also working on my own runtime mostly as a learning experience and I'm just trying to add as much as possible so the more open available tests the better. |
Got it. It's hard for me (or any one person) to approve the adoption of this pattern across all of WPT. My recommendation is to file a separate issue for each specification whose tests you'd like to see generalized. This will help get your request in front of the people who can greenlight it. I'm suggesting this because I may have some bandwidth to help out, but I'd like some indication that patches would be accepted before starting. |
@jugglinmike moving away from JSON to JavaScript doesn't work for non-JavaScript consumers. I don't think that's a good idea. |
@annevk Supporting non-JavaScript consumers is a much more restrictive requirement than what we have discussed in this issue. We'll need to list out all the constraints before we can make progress. As a start, can you give some examples of consumers and tests? |
Consumers might be all kinds of software libraries for tests such as |
That's great! @devsnek: this means that for the URL tests, we don't need to worry about |
@jugglinmike indeed, however the runner that wraps those includes more tests and is wrapped in html, so there is still some to be desired. |
Just FYI, we already have ported most of the URL tests into our code base about a year ago. The current way of porting URL WPT into Node.js is:
Currently only the 4th step needs manual maintenance. Step 1 and 3 can be automated (I have a prototype of node-core-utils that does half of the job). |
AFAIK our timer implementation is pretty far from the web and it cannot be changed for compatibility reasons. e.g. you get a There has been resistance against implementing the WHATWG stream and there is also a new Stream API being proposed (openjs-foundation/summit#82) that's not WHATWG stream. But implementation of other standards may need part of WHATWG stream, e.g. fetch (being considered but it's on and off), esm.
|
Node.js also implemented |
Refactor tests so that they may be consumed by non-browser JavaScript runtimes which implement the standard (e.g. Node.js [1]). Use WPT's `.any.js` convention to extend test coverage in browsers by allowing them to be executed within a Web Worker. This change is in service of web-platform-testsgh-11277 [2] [1] https://nodejs.org/api/perf_hooks.html [2] web-platform-tests#11277
Refactor tests so that they may be consumed by non-browser JavaScript runtimes which implement the standard (e.g. Node.js [1]). Use WPT's `.any.js` convention to extend test coverage in browsers by allowing them to be executed within a Web Worker. This change is in service of gh-11277 [2] [1] https://nodejs.org/api/perf_hooks.html [2] #11277
…=testonly Automatic update from web-platform-tests[performance-timeline] Reformat tests (#11495) Refactor tests so that they may be consumed by non-browser JavaScript runtimes which implement the standard (e.g. Node.js [1]). Use WPT's `.any.js` convention to extend test coverage in browsers by allowing them to be executed within a Web Worker. This change is in service of gh-11277 [2] [1] https://nodejs.org/api/perf_hooks.html [2] web-platform-tests/wpt#11277 -- wpt-commits: 50f1ceebcf83482f7ce4edd5a33f25cd27ee6e38 wpt-pr: 11495
…=testonly Automatic update from web-platform-tests[performance-timeline] Reformat tests (#11495) Refactor tests so that they may be consumed by non-browser JavaScript runtimes which implement the standard (e.g. Node.js [1]). Use WPT's `.any.js` convention to extend test coverage in browsers by allowing them to be executed within a Web Worker. This change is in service of gh-11277 [2] [1] https://nodejs.org/api/perf_hooks.html [2] web-platform-tests/wpt#11277 -- wpt-commits: 50f1ceebcf83482f7ce4edd5a33f25cd27ee6e38 wpt-pr: 11495 UltraBlame original commit: 0e7163be63eb16cba21354a120dfd84f11a56b03
…=testonly Automatic update from web-platform-tests[performance-timeline] Reformat tests (#11495) Refactor tests so that they may be consumed by non-browser JavaScript runtimes which implement the standard (e.g. Node.js [1]). Use WPT's `.any.js` convention to extend test coverage in browsers by allowing them to be executed within a Web Worker. This change is in service of gh-11277 [2] [1] https://nodejs.org/api/perf_hooks.html [2] web-platform-tests/wpt#11277 -- wpt-commits: 50f1ceebcf83482f7ce4edd5a33f25cd27ee6e38 wpt-pr: 11495 UltraBlame original commit: 0e7163be63eb16cba21354a120dfd84f11a56b03
…=testonly Automatic update from web-platform-tests[performance-timeline] Reformat tests (#11495) Refactor tests so that they may be consumed by non-browser JavaScript runtimes which implement the standard (e.g. Node.js [1]). Use WPT's `.any.js` convention to extend test coverage in browsers by allowing them to be executed within a Web Worker. This change is in service of gh-11277 [2] [1] https://nodejs.org/api/perf_hooks.html [2] web-platform-tests/wpt#11277 -- wpt-commits: 50f1ceebcf83482f7ce4edd5a33f25cd27ee6e38 wpt-pr: 11495 UltraBlame original commit: 0e7163be63eb16cba21354a120dfd84f11a56b03
It would be cool if the idlharness.js could be rewritten to not add any global functions and also be rewritten to ESM It would be pretty sweet if it was just possible to import some related tests in nodejs that have written some polyfill and just do: globalThis.formData = await import('./formdata-polyfill.js')
await import('http://wpt.live/FileAPI/file/send-file-formdata-controls.any.js') now thanks to NodeJS and Deno's http loader |
I think we can consider this closed given there's now |
A lot of tests in the suite are for things that don't inherently require a DOM to test in all situations (like the URL constructor as an example) but still are wrapped in html.
As the number of runtimes that don't have a dom but implement these features increases it would seem in the interest of wpt to help support making sure everyone can run tests and stay spec compliant. Node.js as an example has hand copied tests into a form they can run, which is fine at first glance but the tests they have aren't updated to the latest forms of the tests here. Additionally if you are a single person without a huge community, its pretty much impossible to rewrite all these hundreds of tests to be runnable and keep them updated and make sure you don't break any of them.
I think some initiative (at least moving forward) for tests to be more carefully written to just be plain js files if possible would be nice. As for existing tests, even if slowly, we could begin rewriting them. I for one would be happy to help with the rewrites.
The text was updated successfully, but these errors were encountered: