Provides a single module collecting all build / test resources for Node & browser testing TyphonJS modules. This tooling assists in making dual browser / Node ESM packages.
In addition to providing the necessary dependencies this module also has browser test runner code which streamlines testing including:
- Run the same testsuite on Node and in the browser.
- Streamlined execution setup for the common use cases.
- Connecting Mocha in the browser using the default spec reporter to output results in Node console just like if the tests were being executed locally in Node itself.
- Ability to send messages from the browser testsuite to Node context / useful w/ Vite and HMR testing, etc.
polka
andsirv
provide a minimal dependency static web server.nyc
androllup-plugin-istanbul
to instrument and create coverage reports w/ source maps.puppeteer-core
to control headless Chrome / Chromium.
More details and full API overview on the way shortly.
There are examples located in ./examples
polka-sirv
is the standard static code example.
Clone the repo and run npm install
in the example directory.
npm run test-node
to run the testsuite on Node.npm run test-browser
to run the testsuite in the browser.
In the example directory there is an env
directory w/ puppeteer.env
. You must set
PUPPETEER_BIN
to the Chrome executable for your system. Right now the default is set for Windows.
Add this module as a devDependency
and the following modules are added: