Brandon
Brandon5w ago

Deno test fails(using - superoak)

Hi. I am new to deno and I am struggling, can someone kindly assist. I am doing a backend test case for my code but it fails regards of what I do. I do not understand the error nor what to do about it.
./test/auth_test.ts (uncaught error)
error: (in promise) ReferenceError: window is not defined
(window as any)[SHAM_SYMBOL].promises,
^
at completeXhrPromises (https://deno.land/x/superdeno@4.9.0/src/test.ts:192:7)
at https://deno.land/x/superdeno@4.9.0/src/test.ts:558:21
at close (https://deno.land/x/superdeno@4.9.0/src/close.ts:47:52)

info: window global is not available in Deno 2.
hint: Replace `window` with `globalThis`.
./test/auth_test.ts (uncaught error)
error: (in promise) ReferenceError: window is not defined
(window as any)[SHAM_SYMBOL].promises,
^
at completeXhrPromises (https://deno.land/x/superdeno@4.9.0/src/test.ts:192:7)
at https://deno.land/x/superdeno@4.9.0/src/test.ts:558:21
at close (https://deno.land/x/superdeno@4.9.0/src/close.ts:47:52)

info: window global is not available in Deno 2.
hint: Replace `window` with `globalThis`.
No description
No description
No description
5 Replies
toni
toni5w ago
As I can see you're using window object, please install deno 1 then try again
Brandon
BrandonOP5w ago
Thanks, I will try it Thanks again for the assistance. I managed to install deno 1.36. Now I have a different issue when I try to run the test(all tests are in the test folder) , it will not allow me to use --allow-import but deno want to use --allow-hrtime and there is still an issue. [terminal output]
$ deno test test/ --allow-net --allow-sys --allow-read --allow-env --allow-hrtime --log-level=debug
DEBUG RS - deno::args::config_file:757 - Config file found at '/home/brandon/Desktop/Purple_Water/deno/deno.json'
DEBUG RS - deno::args::package_json:151 - No package.json file found
error: Unable to parse contents of lockfile: "/home/brandon/Desktop/Purple_Water/deno/deno.lock"
$ deno test test/ --allow-net --allow-sys --allow-read --allow-env --allow-hrtime --log-level=debug
DEBUG RS - deno::args::config_file:757 - Config file found at '/home/brandon/Desktop/Purple_Water/deno/deno.json'
DEBUG RS - deno::args::package_json:151 - No package.json file found
error: Unable to parse contents of lockfile: "/home/brandon/Desktop/Purple_Water/deno/deno.lock"
toni
toni5w ago
please delete deno.lock, then deno install again, after that can try deno test
Brandon
BrandonOP5w ago
@toni Thanks for the assistance and response, but I am encountering too many issues when using Deno 1.36(certian libraries not supported).
toni
toni5w ago
Anytime! Understand your frustration with Deno 1.36, especially if certain libraries are not supported

Did you find this page helpful?