-
Notifications
You must be signed in to change notification settings - Fork 600
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
feat(WPTRunner): parse META
tags
#1664
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This test is failing and I'm not really sure how to fix it 😕 import { fetch, setGlobalOrigin } from 'undici'
import assert from 'assert'
setGlobalOrigin('http://localhost:3000')
const controller = new AbortController();
const signal = controller.signal;
controller.abort();
const log = [];
await Promise.all([
fetch('../resources/data.json', { signal }).then(
() => assert_unreached("Fetch must not resolve"),
() => log.push('fetch-reject')
),
Promise.resolve().then(() => log.push('next-microtask'))
]);
assert.deepStrictEqual(log, ['fetch-reject', 'next-microtask']); |
Codecov ReportBase: 94.89% // Head: 94.90% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1664 +/- ##
==========================================
+ Coverage 94.89% 94.90% +0.01%
==========================================
Files 53 53
Lines 4803 4813 +10
==========================================
+ Hits 4558 4568 +10
Misses 245 245
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
The edit: the issue is the order in which the promise is resolved/rejected. I don't know how to solve this without breaking the spec. function createDeferredPromise () {
let res
let rej
const promise = new Promise((resolve, reject) => {
res = resolve
rej = reject
})
return { promise, resolve: res, reject: rej }
}
async function fetch () {
const promise = createDeferredPromise()
queueMicrotask(() => promise.reject(new Error('AbortError')))
promise.resolve()
return promise.promise
}
await fetch() // resolves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
* feat(WPTRunner): parse `META` tags * feat: add more routes * feat: add /resources/data.json route * fix(fetch): throw AbortError DOMException on consume if aborted * fix(fetch): throw AbortError on `.formData()` after abort * feat: add expected failures & end log * fix: import DOMException for node 16 * feat: run each test in its own worker & simplify worker
* feat(WPTRunner): parse `META` tags * feat: add more routes * feat: add /resources/data.json route * fix(fetch): throw AbortError DOMException on consume if aborted * fix(fetch): throw AbortError on `.formData()` after abort * feat: add expected failures & end log * fix: import DOMException for node 16 * feat: run each test in its own worker & simplify worker
META
tags and injecting individual scripts into each test. Example ofMETA
tags: https://github.com/web-platform-tests/wpt/blob/master/fetch/api/abort/general.any.js#L1-L5