There are several ways of contributing to Sinon.JS
- Help improve the documentation published at the Sinon.JS website
- Help someone understand and use Sinon.JS on the mailing list
- Report an issue, please read instructions below
- Help with triaging the issues. The clearer they are, the more likely they are to be fixed soon.
- Contribute to the code base.
To save everyone time and make it much more likely for your issue to be understood, worked on and resolved quickly, it would help if you're mindful of How to Report Bugs Effectively when pressing the "Submit new issue" button.
As a minimum, please report the following:
- Which environment are you using? Browser? Node? Which version(s)?
- Which version of SinonJS?
- How are you loading SinonJS?
- What other libraries are you using?
- What you expected to happen
- What actually happens
- Describe with code how to reproduce the faulty behaviour
See our issue template for all details.
Pick an issue to fix, or pitch new features. To avoid wasting your time, please ask for feedback on feature suggestions either with an issue or on the mailing list.
Please try to write great commit messages.
There are numerous benefits to great commit messages
- They allow Sinon.JS users to easily understand the consequences of updating to a newer version
- They help contributors understand what is going on with the codebase, allowing features and fixes to be developed faster
- They save maintainers time when compiling the changelog for a new release
If you're already a few commits in by the time you read this, you can still change your commit messages.
Also, before making your pull request, consider if your commits make sense on their own (and potentially should be multiple pull requests) or if they can be squashed down to one commit (with a great message). There are no hard and fast rules about this, but being mindful of your readers greatly help you author good commits.
To save everyone some time, please use EditorConfig, so your editor helps make sure we all use the same encoding, indentation, line endings, etc.
The Sinon.JS developer environment requires Node/NPM. Please make sure you have Node installed, and install Sinon's dependencies:
$ npm install
This will also install a pre-commit hook, that runs style validation on staged files.
In order to run the tests, you'll need a PhantomJS global.
The test suite runs well with both 1.9.x
and 2.0.0
Sinon.JS uses ESLint to keep consistent style. You probably want to install a plugin for your editor.
The ESLint test will be run before unit tests in the CI environment, your build will fail if it doesn't pass the style check.
$ npm run lint
To ensure consistent reporting of lint warnings, you should use the same version as CI environment (defined in package.json
)
Following command runs unit tests in PhantomJS, Node and WebWorker
$ npm test
Sinon.JS uses Mocha, please read those docs if you're unfamiliar with it.
If you're doing more than a one line edit, you'll want to have finer control and less restarting of the Mocha
To start tests in dev mode run
$ npm run test-dev
Dev mode features:
- watching related files to restart tests once changes are made
- using Min reporter, which cleans the console each time tests run, so test results are always on top
Note that in dev mode tests run only in Node. Before creating your PR please ensure tests are passing in Phantom and WebWorker as well. To check this please use Run the tests instructions.
Build requires Ruby. Under the hood Browserify is used.
To build simply run
$ ./build