modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.22k stars 288 forks source link

failed tests not reflected #403

Open MathieuPuech opened 4 years ago

MathieuPuech commented 4 years ago

While testing the documentation, I forget to create the isMobile.js source file and start the tests. I don't see any failed test when doing this: 3 passed, 0 failed

Full log

npm t

> foo@1.0.0 test C:\Users\Ubisoft\foo
> web-test-runner "test/**/*.test.js" --node-resolve --playwright --browsers chromium firefox webkit

test\responsive.test.js:

 � Browser logs on Chromium:
      TypeError: Failed to fetch dynamically imported module: http://localhost:9236/test/responsive.tes
t.js?wtr-session-id=62bb73cf-7c9a-4fe0-928b-29fb506fe744
 � Browser logs on Firefox:
      [JavaScript Error: "Loading module from “http://localhost:9236/src/isMobile” was blocked because
of a disallowed MIME type (“text/plain”)." {file: "http://localhost:9236/?wtr-session-id=6e073662-ba97-
4524-8ea5-7fb634edcbad" line: 0}]
      [JavaScript Warning: "Loading failed for the module with source “http://localhost:9236/src/isMobi
le”." {file: "http://localhost:9236/?wtr-session-id=6e073662-ba97-4524-8ea5-7fb634edcbad" line: 3}]
      error loading dynamically imported module
      [JavaScript Warning: "Loading failed for the module with source “http://localhost:9236/node_modul
es/@open-wc/testing/import-wrappers/chai.js”." {file: "http://localhost:9236/?wtr-session-id=6e073662-b
a97-4524-8ea5-7fb634edcbad" line: 3}]
 � Browser logs on Webkit:
      Importing a module script failed.

 � 404 network requests:
    - src/isMobile

 ❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more
 information.

Chromium: |██████████████████████████████| 3/3 test files | 3 passed, 0 failed
Firefox:  |██████████████████████████████| 3/3 test files | 3 passed, 0 failed
Webkit:   |██████████████████████████████| 3/3 test files | 3 passed, 0 failed

Error while running tests.
LarsDenBakker commented 4 years ago

This is a good point.

Mocha never saw the tests in your test file, because the browsers stops execution of a module when there are 404s. There are quite a lot of errors already in the logs, but do you think we could make this somehow clearer in the summary at the bottom?

MathieuPuech commented 4 years ago

I see, you can't know if there was any test when it crash. we should know that a test file has crashed, maybe by doing 2/3 test files instead of 3/3 test files ?

LarsDenBakker commented 4 years ago

That could work actually, the message at the bottom can also say something like "Failed to load some test files".