mswjs / msw

Industry standard API mocking for JavaScript.
https://mswjs.io
MIT License
15.97k stars 519 forks source link

XHR Upload events are not being triggered #2263

Closed gmarcos87 closed 2 months ago

gmarcos87 commented 2 months ago

Prerequisites

Environment check

Browsers

No response

Reproduction repository

https://github.com/mswjs/msw/pull/2262

Reproduction steps

  1. Create a XHR request
  2. Add event listeners to the upload object https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/upload
  3. Upload a blob using the XHR request

Current behavior

The upload events are not triggered at any time. This makes it impossible to test any functionality that depends on those events, such as upload progress.

Expected behavior

Events should be triggered as they normally happen in the browser.

kettanaito commented 2 months ago

Should be fixed by https://github.com/mswjs/msw/releases/tag/v2.4.4. XHR now correctly triggers upload events in Node.js (and browser-like). In the browser, that should've been working before as was.