flesh out karma docs
[dygraphs.git] / DEVELOP.md
CommitLineData
341a2d65
DV
1## dygraphs developer notes
2
3So you've made a change to dygraphs and would like to contribute it back to the open source project. Wonderful!
4
5This is a step-by-step guide explaining how to do it.
6
7### How-to
8
9To build dygraphs, run
10
11 gulp dist
12
13To run the tests, run:
14
15 gulp test
16
17To iterate on the code, open `tests/demo.html` (or one of the other demos) in your browser.
18
3b083bd5 19To iterate on a unit test, change `it` to `it.only` in the Mocha test, change the browser from `PhantomJS` to `Chrome` (or whatever you like) and set `singleRun` to `false` in `auto_tests/karma.conf.js`. Then run
341a2d65
DV
20
21 ./node_modules/karma/bin/karma start auto_tests/karma.conf.js
22
23and hit "DEBUG" in the Karma UI.
24
25### dygraphs style
26
27When making a change, please try to follow the style of the existing dygraphs code. This will make the review process go much more smoothly.
28
29A few salient points:
30
311. We try to adhere to Google's [JS style guide][gstyle] and would appreciate it if you try to as well. This means:
32 * No tabs! Indent using two spaces.
33 * Use camelCase for variable and function names.
34 * Limit lines to 80 characters.
351. If you've added a new feature, add a test for it (in the tests/ directory) or a gallery entry.
361. If you've added an option, document it in `dygraph-options-reference.js`. You'll get lots of warnings if you don't.
371. If you've fixed a bug or added a feature, add a unit test (in `auto_tests`) for it.
38
39Adding a unit test ensures that we won't inadvertently break your feature in the future. To do this, either add to an existing test in `auto_tests/tests` or create a new one.
40
41### Sending a Pull Request
42
43To make a change, you'll need to send a Pull Request. See GitHub's documentation [here][pr].
44
45[gstyle]: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
46[pr]: http://help.github.com/send-pull-requests/