JakeChampion/polyfill-library

Feature/Polyfill request: structuredClone

CheloXL opened this issue · 5 comments

As the title says, I would like to have a structuredClone polyfill. At the time of writing, all browsers have implemented this API in their nightly releases, Firefox has shipped it to stable in Firefox 94. Additionally, Node 17 and Deno 1.14 have implemented this API.

structuredClone is not 100% polyfill-able, but the core-js implementation seems to get pretty close, with only a few caveats. @JakeChampion What do you think?

@mhassan1 I have a pull request ready, but I can't run the tests. I'm on windows. Running the tests (after a successfully build) gives me the following output:

START:

Finished in 0.001 secs / 0 secs @ 12:41:05 GMT-0300 (Argentina Standard Time)

SUMMARY:
√ 0 tests completed

command line: npm run test-polyfills -- --features=structuredClone --browsers=FirefoxHeadless --singleRun=true

What it's strange is that it doesn't matter which feature I request for test, I always get 0 tests completed.

Any insights?
Thanks in advance.

Hm, I have never run tests that way. I usually run npm run watch and then load something like http://localhost:9876/test?includePolyfills=yes&always=yes&feature=structuredClone in different browsers. Maybe @JakeChampion or @romainmenke would be more helpful.

I have never run tests that way. I usually run npm run watch and then load something like http://localhost:9876/test?includePolyfills=yes&always=yes&feature=structuredClone in different browsers

Yes, same :)
I think I initially created npm run watch because I didn't fully understand npm run test-polyfills but also didn't want to break/change it.

Excellent, thank you both. That works.