Utility ‐ tape6‐server - uhop/tape-six GitHub Wiki

To run browser-based tests, a web server is needed. tape6-server is a command-line utility, which is a generic web server for static files, it provides an API required to run tests, and it bundles the web application to run tests.

Usage

Assuming that the tests are properly configured (see Set-up tests), it can be invoked without arguments:

npx tape6-server

It serves static files from the current directory as the root. If you navigate to http://localhost:3000 (using the default settings) in your browser, you should see the tests run.

Configuring tape6-server

The utility can be invoked like that:

tape6-server [flags...]

The flags can be one or more of the following:

  • --trace — enable a simple trace logging of HTTP requests and responses.
  • --self — prints its path to stdout and quits. It is used for scripting to avoid some problems with particular runtime environments.

Environment variables

The following environment variables are supported:

  • HOST — the host to listen on. The default is localhost.
  • PORT — the port to listen on. The default is 3000.
  • SERVER_ROOT — the root folder to serve. The default is the current directory.
  • WEBAPP_PATH — the path to the web application. The default is the web application supplied with tape-six.

Implementation details

All tests are executed in a separate newly created IFRAME.

The web application supports the following query parameters:

  • flags — the flags to pass to the test harness. See TAPE6_FLAGS for details.
  • par — the parameters to pass to the test harness. See TAPE6_PAR for details. Defaults to 1.
  • q — a pattern for tests to run. It can be specified multiple times. If not specified, the configured tests will run. See Set-up tests for details.

The web application is served when accessing the root via a redirect.

tape6-server is written using a portable subset of Node API and can be run by Node, Deno, and Bun. See Environment - Browsers for details.