- Refactor the test directory structure. - Imports the `node` tests into the browser, building with webpack. They are the source of truth. - Run headless chrome in Travis. - Run IE9 in Appveyor. - Use `builder` to parallelize running lint and various tests. - Fixes #7
2.1 KiB
Contributing
Thanks for contributing!
Development
Install the project using yarn (which we've standardized on for development):
$ yarn install
tl;dr -- Everything you normally need to run is aggregated into:
$ yarn run test
$ yarn run benchmark
(We use builder to parallelize things, so tasks may output in different
orders)
Testing
We write one set of tests located in:
tests/node/**.spec.js
that run in two very different scenarios:
Node
The tests are natively run in node (hence why they are located in tests/node
to begin with) without any transpilation or "build". You can run them with:
# Single run
$ yarn run test-node
# Persistent watch
$ yarn run test-node --watch
Browsers
The same tests are then imported and built with webpack to a test bundle that
can be run in arbitrary browsers. So far in CI, we execute the tests in headless
Chrome on Linux in Travis and IE9-emulated IE11 in Appveyor.
To run the browser tests on your machine (note: you must already have the browser you're running installed):
# Default: headless chrome
$ yarn run test-browser
# Example: real Chrome + Firefox + Safari
$ yarn run test-browser --browsers Chrome,Firefox,Safari
# IE9 emulation (on Windows)
$ yarn run test-browser-ie
Types
We validate our TypeScript index.d.ts with:
$ yarn run test-ts
Style
$ yarn run eslint
Before submitting a PR...
Before you go ahead and submit a PR, make sure that you have done the following:
$ yarn run test
$ yarn run benchmark
Everything must be correct / pass checks. You should also check the benchmark
stats and make sure that we don't have any significant performance regressions
(check out master for a baseline comparison on your machine).
Releasing a new version to NPM
Only for project administrators.
- Run
npm version patch(orminor|major|VERSION) to run tests and lint, build published directories, then updatepackage.json+ add a git tag. - Run
npm publishand publish to NPM if all is well. - Run
git push && git push --tags