All test files are inside the test/ directory and ends with .test.html
.
If one or more test is failing, the main GitHub workflow will fail during check tests step.
Code coverage from test files is monitored, this is documented in docs/code_coverage/code_coverage.md.
If you want to keep test files check How to use tests. Otherwise see How to remove tests.
Test files are written using jsenv philosophy:
A test file is a regular html file.
As previously mentioned, according to jsenv philosophy a test file executes like a standard file. A test file can be debugged using the development server and Chrome devtools.
Use npm test
command. It is configured to execute scripts/test.mjs which is responsible to find and execute all your test files.
Test files are executed twice, a first time on Chrome, a second time on Firefox.
> node ./scripts/test.mjs
✔ execution 1 of 2 completed (all completed)
file: tests/greet.test.html
runtime: chromium/97.0.4666.0
duration: 1.6 seconds
✔ execution 2 of 2 completed (all completed)
file: tests/greet.test.html
runtime: firefox/93.0
duration: 1.6 seconds
-------------- summary -----------------
2 executions: all completed
total duration: 3.7 seconds
----------------------------------------
See Code coverage.
If you don't need test or want to use an other test framework/library follow the steps below.
-
Remove
Run tests
step in .github/workflows/main.yml -
Remove these
"scripts"
in package.json"test"
"test:coverage"
"playwright-install"
-
Delete scripts/test.mjs
-
Remove
"@jsenv/assert"
from"devDependencies"
package.json