Open andrija-tosic-rs opened 1 month ago
This is a problem with superdeno module. I am not quite familiar with the code that handles the xhr sham, but you can try this workaround to make your tests work with Deno v2 and superoak.
Before your tests, run this line:
(globalThis as any).window = globalThis;
Hi all 👋
As @petruki points out, it seems there has been a long lived bug in https://github.com/cmorten/superdeno/blob/main/src/test.ts#L192 which makes Deno v2 fall over (this line should read (globalThis as any)[SHAM_SYMBOL].promises
!)
I could patch this line however both superdeno and superoak were only ever meant to be drop-in replacements for the supertest
package in a world where NPM wasn't supported by Deno.
Deno is now very much claiming Node and NPM compatability (especially with v2) so I would encourage as you do the major upgrades to consider migrating off of superdeno and superoak.
I might consider continuing to support superoak as a thin wrapper over supertest, but will most likely look to sunset superdeno now that it's purpose is over.
Thank you both for responding so quickly. If you don't have anything to add, I can close this issue.
Issue
Setup:
Details
Deno test started breaking after upgrading to Deno 2.0:
Test code:
Superoak still works fine on Deno 1.46.3, the latest Deno 1.x version before 2.0.