Skip to content

Latest commit

 

History

History
56 lines (34 loc) · 2.19 KB

CONTRIBUTING.md

File metadata and controls

56 lines (34 loc) · 2.19 KB

Contributing to jsPerf

Submit a pull request to master with passing tests (npm test) and properly styled code. Rebase as needed.

During development it may be helpful to automatically restart the server when you make changes.

npm run watch

Building the client

If you make any changes inside client/, then you'll need to manually re-build the final asset.

npm run build

Testing

We use lab as our test utility and code as our assertion library. Lab lints with eslint using the semistandard style. 100% code coverage by unit tests is required. To run the test suite:

npm test

If you want to only lint and save a little time, use npm run lint which skips the tests.

If you are missing code coverage, open coverage.html in the root of the project for a detailed visual report.

End-to-end (e2e)

End-to-end testing is done by Selenium Webdriver. SauceLabs provides Selenium infrastructure for CI. To run tests locally, you'll need Chrome and webdriver-manager.

npm i -g webdriver-manager

webdriver-manager update

In one terminal, have jsPerf running (npm start). In another, have webdriver-manager running (webdriver-manager start). And in yet another, run the tests:

SELENIUM_SERVER=http://127.0.0.1:4444/wd/hub npm run test-e2e

Known Globals

Lab detects global variable leaks. Sometimes downstream dependencies make this unavoidable so we ignore specific variables in the lab command for npm test (package.json#scripts.test). Here are the known globals with explanations:

  • __core-js_shared__ stems from core-js?
  • __grim__ stems from grim, a dependency of marky-markdown (npm ls grim)

Adding new dependencies

Install using npm and either --save or --save-dev. Do not edit package.json manually.