You are using jsdom 25, current is 28, and it comes with TextEncoder/TextDecoder since >=27.4.0
The implementation it uses is @exodus/bytes/encoding.js
https://www.npmjs.com/package/@sinonjs/text-encoding (and the deprecated package it forked) fails WPT and other tests, while that impl passes them.
It also seems impossible to file issues to https://github.com/sinonjs/text-encoding, and this repo seems to be the only intended consumer?
I suggest you deprecate it and replace with @exodus/bytes/encoding.js (or @exodus/bytes/encoding-lite.js if you don't need legacy multi-byte encodings support in TextDecoder).
Also you seem to only be using TextEncoder, and doing that incorrectly.
TextEncoder (including in your own package which is a fork of a deprecated repo) supports only UTF-8 encoding, while you are passing a label to it.
|
return new GlobalTextEncoder(encoding || "utf-8").encode(body).buffer; |
You don't even the whole polyfill here, just import { utf8fromString } from '@exodus/bytes/utf8.js', then e.g. utf8fromString(string).slice(0).buffer
You are using jsdom 25, current is 28, and it comes with TextEncoder/TextDecoder since >=27.4.0
The implementation it uses is @exodus/bytes/encoding.js
https://www.npmjs.com/package/@sinonjs/text-encoding (and the deprecated package it forked) fails WPT and other tests, while that impl passes them.
It also seems impossible to file issues to https://github.com/sinonjs/text-encoding, and this repo seems to be the only intended consumer?
I suggest you deprecate it and replace with
@exodus/bytes/encoding.js(or@exodus/bytes/encoding-lite.jsif you don't need legacy multi-byte encodings support in TextDecoder).Also you seem to only be using TextEncoder, and doing that incorrectly.
TextEncoder (including in your own package which is a fork of a deprecated repo) supports only UTF-8 encoding, while you are passing a label to it.
nise/lib/fake-xhr/index.js
Line 145 in 1316c82
You don't even the whole polyfill here, just
import { utf8fromString } from '@exodus/bytes/utf8.js', then e.g.utf8fromString(string).slice(0).buffer