1## Developer instructions 2 3### Setup 4 51. Fork web-animations/web-animations-js. 61. `git clone git@github.com:$GITHUB_USER/web-animations-js.git` 71. `git submodule update --init --recursive` (Necessary for running tests.) 81. Install [node](https://nodejs.org/en/) and make sure `npm` is in your $PATH 91. Run `npm install` in the respository to pull in development dependencies. 101. Run `npm install -g grunt-cli` to get the build tools for the command line. 11 12### Contributing 13 14Note that development should occur against the `dev` branch, not `master`. This 15is the default target for pull requests. 16 171. In your fork of web-animations-js, `git checkout dev` or create a new branch whose parent is dev. 181. Run `grunt` to build the polyfill. 191. Run `grunt test` to run polyfill and web-platform-tests tests. 201. Commit changes to your fork. 211. Create a pull request from your fork of web-animations-js to 22 [web-animations/web-animations-js/dev](https://github.com/web-animations/web-animations-js/tree/dev). 231. Ensure that you've signed the [Google Contributor License Agreement](https://cla.developers.google.com/clas). 24 25 26## Debugging tests 27 28You can run the tests in an interactive mode with `grunt debug`. This starts the 29Karma server once for each polyfill target for each test framework. 30Navigate to `http://localhost:9876/debug.html` to open the test runner in your 31browser of choice, all test results appear in the Javascript console. 32Test failures can be accessed via `window.failures` and `window.formattedFailures` 33once the tests have completed. 34 35The polyfill target and tests can be specified as arguments to the `debug` task. 36Example: `grunt debug:web-animations-next:test/web-platform-tests/web-animations/animation/pause.html` 37Multiple test files may be listed with comma separation. Specifying files will output their URL in the command line. 38Example: `http://localhost:9876/base/test/web-platform-tests/web-animations/animation/pause.html` 39 40 41## Design notes 42 43[Design diagrams](https://drive.google.com/folderview?id=0B9rpPoIDv3vTNlZxOVp6a2tNa1E&usp=sharing) 44 45 46## Publishing a release 47 481. Determine the version number for the release 49 50 * Increment the first number and reset others to 0 when there are large breaking changes 51 * Increment the second number and reset the third to 0 when there are significant new, but backwards compatible features 52 * Otherwise, increment the third number 53 541. Add versioned release notes to `History.md`, for example: 55 56 ### 3.13.37 — *November 1, 2001* 57 58 * Fixed a bug where nothing worked 59 60 Use the following to generate a summary of commits, but edit the list to contain only 61 relevant information. 62 63 git log --first-parent `git describe --tags --abbrev=0 master`..dev --pretty=format:" * %s" 64 651. Specify the new version inside `package.json` (for NPM), for example: 66 67 ```js 68 "version": "3.13.37", 69 ``` 70 711. Build the polyfill with `npm install && grunt` then update `docs/experimental.md`'s Build Target Comparison with the current gzipped sizes. 72 731. Commit the above changes to web-animations-js/dev and merge to 74 web-animations-js/master. 75 76 ```sh 77 git checkout master 78 git merge dev --no-edit --quiet 79 ``` 80 811. Build and commit minified JavaScript files. 82 83 ```sh 84 npm install 85 grunt 86 # Optional "grunt test" to make sure everything still passes. 87 git add -f *.min.js{,.map} 88 git rm .gitignore 89 git commit -m 'Add build artifacts from '`cat .git/refs/heads/dev` 90 git push HEAD:refs/heads/master 91 ``` 92 931. Draft a [new release](https://github.com/web-animations/web-animations-js/releases) at the 94 commit pushed to web-animations-js in step #4. Copy the release notes from `History.md` 95 added in step #2. 96 971. Once you've pushed to web-animations-js, run `npm publish` from that checked-out folder 98 99 To do this, you'll need to be a collaborator [on the NPM project](https://www.npmjs.com/package/web-animations-js), or have a collaborator help you. 100 1011. If there are any breaking changes to the API in this release you must notify web-animations-changes@googlegroups.com. 102 103 Only owners of the group may post to it so you may need to request ownership or ask someone to post it for you. 104 105## Testing architecture 106 107This is an overview of what happens when `grunt test` is run. 108 1091. Polyfill tests written in mocha and chai are run. 110 1. grunt creates a karma config with mocha and chai adapters. 111 1. grunt adds the test/js files as includes to the karma config. 112 1. grunt starts the karma server with the config and waits for the result. 113 1. The mocha adaptor runs the included tests and reports the results to karma. 114 1. karma outputs results to the console and returns the final pass/fail result to grunt. 1151. web-platform-tests/web-animations tests written in testtharness.js are run. 116 1. grunt creates a karma config with karma-testharness-adaptor.js included. 117 1. grunt adds the web-platform-tests/web-animations files to the custom testharnessTests config in the karma config. 118 1. grunt adds failure expectations to the custom testharnessTests config in the karma config. 119 1. grunt starts the karma server with the config and waits for the result. 120 1. The testharness.js adaptor runs the included tests (ignoring expected failures) and reports the results to karma. 121 1. karma outputs results to the console and returns the final pass/fail result to grunt. 1221. grunt exits successfully if both test runs passed. 123 124