test: enable wpt fetch/api idlharness tests#61940
Closed
vitkarpov wants to merge 1 commit intonodejs:mainfrom
Closed
test: enable wpt fetch/api idlharness tests#61940vitkarpov wants to merge 1 commit intonodejs:mainfrom
vitkarpov wants to merge 1 commit intonodejs:mainfrom
Conversation
Collaborator
|
Review requested:
|
Enables fetch/api/idlharness.https.any.js from the WPT suite in Node's test runner. This test formally documents the property descriptor regression reported in nodejs#45099 — Headers, Request, and Response are currently exposed on globalThis as getter/setter accessor pairs rather than plain { value, writable, enumerable: false, configurable: true } data properties as required by WebIDL.
f02ef88 to
45ee342
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61940 +/- ##
==========================================
+ Coverage 88.84% 89.77% +0.92%
==========================================
Files 674 674
Lines 204957 204957
Branches 39309 39381 +72
==========================================
+ Hits 182087 183990 +1903
+ Misses 15088 13271 -1817
+ Partials 7782 7696 -86 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs: #45099
Summary
Enables
fetch/api/idlharness.https.any.jsfrom the WPT suite in Node's test runner. This test formally documents the property descriptor regression reported in #45099 —Headers,Request, andResponseare currently exposed onglobalThisas getter/setter accessor pairs rather than plain{ value, writable, enumerable: false, configurable: true }data properties as required by WebIDL.Enabling the test with known failures as
fail.expectedcreates a CI gate so the regression can't silently worsen and the fix (targeted in a follow-up PR, if you guys think this work makes sense) will be verified automatically.Changes
WPT fixture sync (
git node wpt fetch/api+git node wpt interfaces)test/fixtures/wpt/fetch/api/— the full upstreamfetch/apitest treetest/fixtures/wpt/interfaces/fetch.idlandreferrer-policy.idl— required by theidlharness test's
idl_test(['fetch'], ['referrer-policy', 'html', 'dom'], ...)callinterfaces/*.idlfiles andversions.jsonto match the synced commitNew test driver (
test/wpt/test-fetch.js)fetch/apiwithpretendGlobalThisAs('Window')since the idlharness test branches onself.GLOBAL.isWindow()New status file (
test/wpt/status/fetch/api.json)skip: "Requires a WPT HTTP server"— these tests needa running
wptserve/Python backend and are already covered innodejs/undici's WPT CI(see comment in
test/common/wpt/worker.js)idlharness.https.any.jsgets 15fail.expectedentries:Headers,Request,Responseproperty descriptor bug (FormData, Response, Request, and Headers have incorrect property descriptors #45099)FetchLaterResult(unimplemented API)Window: fetchLaterinstance checks (unimplemented API)Window: fetchinstance checks (lazy accessor meansfetchis an own property ofglobalThis, not prototype-inherited as idlharness expects)Window: operation fetchLater(unimplemented API)WPT runner infrastructure fixes (
test/common/wpt/worker.js,test/common/wpt.js)worker.jsdefinedglobalThis.GLOBALwithoutisWorker():globalThis.GLOBAL = { isWindow() { return false; }, + isWorker() { return false; }, isShadowRealm() { return false; }, };Any test calling
self.GLOBAL.isWorker()would throwTypeError: self.GLOBAL.isWorker is not a function. Thetest/wpt/test-hr-time.jsdriver was already working around this by patching it in an init script; that workaround remains but is now redundant.pretendGlobalThisAs('Window')inwpt.jswas settingglobalThis.Windowbut leavingGLOBAL.isWindow()returningfalse, so tests pretending to be a Window context still reported themselves as non-Window. Fixed by pushingglobalThis.GLOBAL.isWindow = () => truealongside the existingglobalThis.Windowassignment.Test result