Contributing to firebase-server is fairly easy. This document shows you how to
get the project, run all provided tests and generate a production ready build.
It also covers provided npm scripts, that help you developing on firebase-server.
To make sure that the following instructions work, please install the following dependencies on you machine:
- Node.js
- npm
- Git
You should also consider nvm or some similar tool which lets you switch between versions of Node quickly.
To get the source of firebase-server clone the git repository via:
git clone https://github.com/urish/firebase-serverThis will clone the complete source to your local machine. Navigate to the project folder and install all needed dependencies via npm:
npm installWell done! firebase-server is now installed and you can start tinkering with it.
firebase-server comes with a few npm scripts which help you to automate
the development process. The following npm scripts are provided:
npm test executes (as you might thought) the unit tests, which are located
in the test directory. The task uses the mocha test runner to execute
the tests, and istanbul for tracking the code coverage. This task also checks
the coding for potential programming errors using eslint.
You should ensure npm test passes on node 0.10, and 4.x before submitting a PR
npm run debug executes the unit tests in debugging mode. It skips the linter,
and runs mocha without the coverage tool (the coverage tool slows tests and obfuscates error stack traces).
You can also just call mocha from the command line, if you installed mocha globally (npm install --global mocha).
npm run watch will watch the source files and rerun the tests every time a file changes.
You can also just call mocha -w from the command line, if you installed mocha globally (npm install --global mocha).
- If you are changing the API or adding features, it is highly recommended that you open an issue on GitHub to propose your change and get feedback before beginning work.
- Check out the open issues for ideas on where to contribute.
- Checkout a new branch based on
masterand name it to what you intend to do:- Example:
$ git checkout -b BRANCH_NAME - Use one branch per fix/feature
- Example:
- Make your changes
- Make sure to provide a spec for unit tests (in
test/server.spec.tsor similar). You should strive for 100% coverage of any code you add (this is not a strict requirement). - Run your tests with
npm test - When all tests pass, everything is fine
- Make sure to provide a spec for unit tests (in
- Commit your changes
- Please provide a git message which explains what you have done.
- Commit to the forked repository
- Make a pull request
If you follow these instructions, your PR will land pretty safely in the main repo!
Chrome DevTools includes a very handy tool for inspecting Websocket communications, but it is a little hard to find. Note the highlighted selections in the screenshot below:
- Open the Network Tab in Chrome Dev Tools.
- Enable filtering and then filter by web sockets (by clicking
WS). - Select the connection you are interested in (
.ws?v=...) - Click on
Framesto see the entire chat between the client and the server:
You can match requests and responses by looking at the d.r parameter, which is the sequential request id.
