Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests failing on windows/deno for %@event #57

Closed
lowlighter opened this issue Dec 18, 2024 · 0 comments · Fixed by #60
Closed

unit tests failing on windows/deno for %@event #57

lowlighter opened this issue Dec 18, 2024 · 0 comments · Fixed by #60

Comments

@lowlighter
Copy link
Owner

lowlighter commented Dec 18, 2024

Scope

http, repo

Environment

deno, windows

What is happening?

Followup of #56, #53

All the tests on deno + windows works except for the http/event directive for some reason (the regular http directive work as expected)

It can be narrowed down to:

mizu/@mizu/http/mod.ts

Lines 167 to 170 in 2099e6f

const $response = fetch(url, { redirect, method, headers: state.$headers as Headers, body: state.$body as BodyInit })
if ($event) {
await renderer.render(element, { ...options, state: { ...state, $event, $response: await $response } })
}

The response "vanishes" in the void. There is no "apparent error", at least trying to catch the error with try/catch or .catch() has no effect. not sure if it gets caught by jsdom global error handler ?

While I was not able to confirm the promise to resolve, I do think it eventually resolves since the test still completes.
All the errors of this directive are probably the same one, the http server doesn't seem to receive the request (and does not errors too, checked with .on(error)) so there is definitely something strange

It could be an upstream an error

Logs
 ERRORS 

 %@event  reacts to events and performs http sequence => https://jsr.io/@libs/testing/4.0.1/_testing/deno.ts:7:26
error: AssertionError: Expected object to be an instance of "Request" but was "null".
  throw new AssertionError(msg);
        ^
    at assertInstanceOf (https://jsr.io/@std/assert/1.0.9/instance_of.ts:63:9)
    at toBeInstanceOf (https://jsr.io/@std/expect/1.0.9/_matchers.ts:209:5)
    at applyMatcher (https://jsr.io/@std/expect/1.0.9/expect.ts:223:13)
    at Proxy.<anonymous> (https://jsr.io/@std/expect/1.0.9/expect.ts:233:13)
    at eval (eval at script (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:184:18), <anonymous>:6:24)
    at eventLoopTick (ext:core/01_core.js:214:9)
    at async script (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:185:3)
    at async test.permissions.net (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:74:15)

 %@event  inherits modifiers from %http directive => https://jsr.io/@libs/testing/4.0.1/_testing/deno.ts:7:26
error: AssertionError: Expected object to be an instance of "Request" but was "null".
  throw new AssertionError(msg);
        ^
    at assertInstanceOf (https://jsr.io/@std/assert/1.0.9/instance_of.ts:63:9)
    at toBeInstanceOf (https://jsr.io/@std/expect/1.0.9/_matchers.ts:209:5)
    at applyMatcher (https://jsr.io/@std/expect/1.0.9/expect.ts:223:13)
    at Proxy.<anonymous> (https://jsr.io/@std/expect/1.0.9/expect.ts:233:13)
    at eval (eval at script (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:184:18), <anonymous>:6:24)
    at eventLoopTick (ext:core/01_core.js:214:9)
    at async script (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:185:3)
    at async test.permissions.net (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:74:15)

 %@event  supports multiple listeners => https://jsr.io/@libs/testing/4.0.1/_testing/deno.ts:7:26
error: AssertionError: Values are not strictly equal.


    [Diff] Actual / Expected


-   0
+   1

  throw new AssertionError(message);
        ^
    at assertStrictEquals (https://jsr.io/@std/assert/1.0.9/strict_equals.ts:66:9)
    at toBe (https://jsr.io/@std/expect/1.0.9/_matchers.ts:29:5)
    at applyMatcher (https://jsr.io/@std/expect/1.0.9/expect.ts:223:13)
    at Proxy.<anonymous> (https://jsr.io/@std/expect/1.0.9/expect.ts:233:13)
    at eval (eval at script (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:184:18), <anonymous>:7:21)
    at eventLoopTick (ext:core/01_core.js:214:9)
    at async script (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:185:3)
    at async test.permissions.net (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:74:15)

 %@event  with object notation attaches listeners => https://jsr.io/@libs/testing/4.0.1/_testing/deno.ts:7:26
error: AssertionError: Values are not strictly equal.


    [Diff] Actual / Expected


-   null
+   "foo"

  throw new AssertionError(message);
        ^
    at assertStrictEquals (https://jsr.io/@std/assert/1.0.9/strict_equals.ts:66:9)
    at toBe (https://jsr.io/@std/expect/1.0.9/_matchers.ts:29:5)
    at applyMatcher (https://jsr.io/@std/expect/1.0.9/expect.ts:223:13)
    at Proxy.<anonymous> (https://jsr.io/@std/expect/1.0.9/expect.ts:233:13)
    at eval (eval at script (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:184:18), <anonymous>:6:21)
    at eventLoopTick (ext:core/01_core.js:214:9)
    at async script (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:185:3)
    at async test.permissions.net (file:///D:/a/mizu/mizu/@mizu/internal/testing/test.ts:74:15)

 FAILURES 

 %@event  reacts to events and performs http sequence => https://jsr.io/@libs/testing/4.0.1/_testing/deno.ts:7:26
 %@event  inherits modifiers from %http directive => https://jsr.io/@libs/testing/4.0.1/_testing/deno.ts:7:26
 %@event  supports multiple listeners => https://jsr.io/@libs/testing/4.0.1/_testing/deno.ts:7:26
 %@event  with object notation attaches listeners => https://jsr.io/@libs/testing/4.0.1/_testing/deno.ts:7:26

Minimal reproduction example

Run deno test on windows

I have searched for existing issues

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant