This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
TripSit_Suite/node_modules/sinon/CONTRIBUTING.md
2020-11-01 22:46:04 +00:00

5.5 KiB
Raw Blame History

Contributing to Sinon.JS

There are several ways of contributing to Sinon.JS

Contributor Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Reporting an issue

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 youre 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.

Contributing to the code base

Pick an issue to fix, or pitch new features. To avoid wasting your time, please ask for feedback on feature suggestions with an issue.

Make sure you have read GitHubs guide on forking. It explains the general contribution process and key concepts.

Making a pull request

Please try to write great commit messages.

There are numerous benefits to great commit messages

  • They allow Sinon.JS users to 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 youre 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.

Use EditorConfig

To save everyone some time, please use EditorConfig, so your editor helps make sure we all use the same encoding, indentation, line endings, etc.

Installation

The Sinon.JS developer environment requires Node/NPM. Please make sure you have Node installed, and install Sinons dependencies:

$ npm install

This will also install a pre-commit hook, that runs style validation on staged files.

Compatibility

For details on compatibility and browser support, please see COMPATIBILITY.md

Linting and style

Sinon.JS uses ESLint to keep the codebase free of lint, and uses Prettier to keep consistent style.

If you are contributing to a Sinon project, youll probably want to configure your editors (ESLint, Prettier) to make editing code a more enjoyable experience.

The ESLint verification (which includes Prettier) will be run before unit tests in the CI environment. The build will fail if the source code does not pass the style check.

You can run the linter locally:

$ npm run lint

You can fix a lot lint and style violations automatically:

$ npm run lint -- --fix

To ensure consistent reporting of lint warnings, you should use the same versions of ESLint and Prettier as defined in package.json (which is what the CI servers use).

Run the tests

Following command runs unit tests in PhantomJS, Node and WebWorker

$ npm test
Testing in development

Sinon.JS uses Mocha, please read those docs if youre unfamiliar with it.

If youre doing more than a one line edit, youll 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.

Compiling a built version

Build requires Node. Under the hood Browserify is used.

To build run

$ node build.js