Skip to content

feat(WPTRunner): parse META tags#1664

Merged
ronag merged 8 commits intonodejs:mainfrom
KhafraDev:add-wpt
Sep 28, 2022
Merged

feat(WPTRunner): parse META tags#1664
ronag merged 8 commits intonodejs:mainfrom
KhafraDev:add-wpt

Conversation

@KhafraDev
Copy link
Copy Markdown
Member

@KhafraDev KhafraDev commented Sep 23, 2022

@KhafraDev

This comment was marked as outdated.

@KhafraDev
Copy link
Copy Markdown
Member Author

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-commenter
Copy link
Copy Markdown

codecov-commenter commented Sep 24, 2022

Codecov Report

Base: 94.89% // Head: 94.90% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (ce2c132) compared to base (9c3f34c).
Patch coverage: 100.00% of modified lines in pull request are covered.

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              
Impacted Files Coverage Δ
lib/fetch/body.js 97.26% <100.00%> (+0.15%) ⬆️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@KhafraDev KhafraDev marked this pull request as ready for review September 24, 2022 15:30
Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@KhafraDev
Copy link
Copy Markdown
Member Author

KhafraDev commented Sep 27, 2022

The throwIfAborted steps in the body mixin methods aren't correct - there's a bug somewhere in undici I haven't managed to figure out just yet. However it could also be fixed in a separate pr as the workaround doesn't seem to cause issues.

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

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ronag ronag merged commit e5ee395 into nodejs:main Sep 28, 2022
@KhafraDev KhafraDev deleted the add-wpt branch September 28, 2022 14:47
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
* 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
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants