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.
polkaandsirvprovide a minimal dependency static web server.nycandrollup-plugin-istanbulto instrument and create coverage reports w/ source maps.puppeteer-coreto control headless Chrome / Chromium.
More details and full API overview on the way shortly.
There are examples located in ./examples
polka-sirvis the standard static code example.
Clone the repo and run npm install in the example directory.
npm run test-nodeto run the testsuite on Node.npm run test-browserto 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: