Skip to content

Commit

Permalink
Updates to the contribution guide (#2949)
Browse files Browse the repository at this point in the history
* Update to guides

* Update the PR template.

* Typo fix
  • Loading branch information
jeffposnick committed Oct 13, 2021
1 parent 80cbaf6 commit cef23f1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
5 changes: 1 addition & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -1,7 +1,4 @@
**Prior to filing a PR, please:**

- [open an issue](https://github.com/GoogleChrome/workbox/issues/new) to discuss your proposed change.
- ensure that `gulp build && gulp lint test` passes locally.
**Prior to creating a pull request, please follow all the steps in the [contributing guide](https://github.com/GoogleChrome/workbox/blob/v6/CONTRIBUTING.md).**

R: @jeffposnick @tropicadri

Expand Down
44 changes: 34 additions & 10 deletions CONTRIBUTING.md
Expand Up @@ -17,30 +17,54 @@ accept your pull requests.
1. Submit an issue describing your proposed change to the repo in question.
1. The repo owner will respond to your issue promptly.
1. If your proposed change is accepted, and you haven't already done so, sign a Contributor License Agreement (see details above).
1. Fork the repo, develop and test your code changes.
1. Fork the repo, develop and test your code changes (see details below).
1. Ensure that your code adheres to the existing style in the sample to which you are contributing.
1. Submit a pull request.

## Running the Test Suite
## Setting up your environment

Workbox's test suite is split in two parts, one for the Node-based tooling (workbox-cli, workbox-webpack-plugin, etc.) and one for the browser-based ServiceWorker code.
Workbox uses [`node`](https://nodejs.org/) and its related toolchain (`npm`, etc.) to install dependencies and run the build and test processes. Please ensure that you have a working `node` installation before proceeding.

To run the tests for the Node-based tooling:
Workbox uses `git` hooks via [`husky`](https://typicode.github.io/husky/#/) to automatically run code formatters and linters when committing and pushing code to GitHub. If you're running into issues with the `git` hooks, you may need to [create a `~/.huskyrc` file](https://typicode.github.io/husky/#/?id=command-not-found) to set up your `$PATH` correctly.

It's expected that the Workbox development environment should work on Windows, macOS, and Linux. If you encounter any platform-specific issues, please [open a bug](https://github.com/GoogleChrome/workbox/issues/new).

## Testing your contribution

When making local changes, you'll probably want to ensure that your code builds and passes our test suite. To do this, run the following in your local clone of the repo:

```sh
$ npm ci

$ npm run gulp build

$ npm run gulp test
```

Note that on Windows, `npm run gulp test` will only run a subset of our test suite. The full test suite will always be run as part of the GitHub continuous integration environment against your pull request.

When you add a new feature or fix a bug, please check the test suite to see if its appropriate to add or modify an existing test to cover the updated functionality.

## Running a subset of the tests

Workbox's test suite is split in two parts: one for the `node`-based tooling (`workbox-cli`, `workbox-build`, `workbox-webpack-plugin`) and one for the browser-based code.

To run the tests for just the `node`-based tooling:

```sh
npm run gulp test_node
```

To interactively run tests for the browser-based code, launch the test server:

```
```sh
npm run gulp test_server
```

Then open your web browser to http://localhost:3004/ and browser for the test suite for the workbox package you're interested in. For example, to run the tests for workbox-strategies, go o http://localhost:3004/test/workbox-streams/sw/.
Then open a web browser to http://localhost:3004/ and navigate to the test suite for the package you're interested in. For example, to run the tests for `workbox-strategies`, go to http://localhost:3004/test/workbox-streams/sw/

To do an automated run of the full test suite for the browser-based code against the full set of supported browsers:
To do an automated run of the browser-based test suite against the full set of supported browsers, run:

```
npm run gulp test_integration
```
````sh
npm run gulp test_integration ```
````
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -16,7 +16,8 @@ Workbox is a collection of JavaScript libraries for
Development happens in the open on GitHub. We're thankful to the community for
contributing any improvements.

Please read the [guide to contributing](CONTRIBUTING.md) prior to filing any
Please read the [guide to contributing](CONTRIBUTING.md) for information about
setting up your environment and other requirements prior to filing any
pull requests.

## License
Expand Down

0 comments on commit cef23f1

Please sign in to comment.