Environment ‐ Browsers - uhop/tape-six GitHub Wiki
The tape-six tests can be run in a browser using a web server. A server can be something like nginx or Apache. Or you can use tape6-server to serve your project directory as a root. See other command line environments for how to run the server.
Example:
tape6-server --traceSee notes on how to run tape6-server in different environments:
tape6-server will serve the web application that executes tests and shows results. Just navigate
to (the typical location): http://localhost:3000/
Don't forget to set up the importmap to specify paths used by your tests.
See Set-up tests for details.
-
?flags=FO— a way to supply flags to the test runner. See supported flags.- Supports multiple parameters, e.g.,
?flags=FO&flags=M.
- Supports multiple parameters, e.g.,
-
?par=5— a way to specify the number of parallel tests to run. Default:1. -
?q=/tests/test-general.js— a way to specify a test file to run. Default: whatever is specified in the configuration. See set-up tests.- Supports multiple parameters to specify multiple test files.
Individual tests can be run using a shim HTML and a web server (e.g., tape6-server).
Example of a shim located at /tests/browser/test-simple.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Tape-six tests</title>
<script type="importmap">
{
"imports": {
"tape-six": "/node_modules/tape-six/index.js",
"tape-six/": "/node_modules/tape-six/src/"
}
}
</script>
<script type="module" src="../manual/test-three-tests.js"></script>
<!-- <script type="module" src="/tests/test-sample.js"></script> -->
<!-- could be more tests scripts -->
</head>
<body>
<h1>Tape-six tests</h1>
<p>See the console.</p>
</body>
</html>If you used localhost:3000 as the host, it can be reached at http://localhost:3000/tests/browser/test-simple.html
Running HTML files is fully supported, but it doesn't show the results on the web page. Use the console tab of your browser to view the results.
HTML files can be included in the configuration together with JavaScript/TypeScript files, but only for browser environments.
For automated headless browser testing, use the dedicated packages:
- tape-six-puppeteer — runs configured browser tests with Puppeteer.
- tape-six-playwright — runs configured browser tests with Playwright.
See also the wiki pages for reference: