0.0.12 • Published 4 years ago
@typhonjs-utils/build-test-browser v0.0.12
@typhonjs-utils/build-test-browser
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/ Snowpack 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 two examples located in ./examples
polka-sirvis the standard static code example.snowpackprovides an HMR update example controlled by the testsuite executing in the browser.
Clone the repo and run npm install in either example directory.
npm run test-nodeto run the testsuite on Node.npm run test-browserto run the testsuite in the browser.
In each 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 MacOS.
Add this module as a devDependency and the following modules are added: