Skip to content

Commit

Permalink
Move to Jest Documentation (#1390)
Browse files Browse the repository at this point in the history
* Move to Jest Documentation

- Move from Mocha to Jest documentation
- Remove rewire docs and replace with Jest snapshot information

* Minor edits

Overall very good, only a few minor edits for style.

* Remove jest-cli cmd

* Update commands.md

* Update deployment.md
  • Loading branch information
outdooricon authored and gihrig committed Dec 30, 2016
1 parent 68abb90 commit 62b5d42
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 143 deletions.
37 changes: 6 additions & 31 deletions docs/general/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,42 +90,17 @@ about our testing setup!
## Unit testing

```Shell
npm run test
npm test
```

Tests your application with the unit tests specified in the `*test.js` files
Tests your application with the unit tests specified in the `**/tests/*.js` files
throughout the application.
All the `test` commands allow an optional `-- --grep string` argument to filter
the tests ran by Karma. Useful if you need to run a specific test only.
All the `test` commands allow an optional `-- [string]` argument to filter
the tests run by Jest. Useful if you need to run a specific test only.

```Shell
# Run only the Button component tests
npm run test:watch -- --grep Button
```

### Browsers

To choose the browser to run your unit tests in (Chrome by default), run one of
the following commands:

#### Firefox

```Shell
npm run test:firefox
```

#### Safari

```Shell
npm run test:safari
```

#### Internet Explorer

*Windows only!*

```Shell
npm run test:ie
npm test -- Button
```

### Watching
Expand All @@ -134,7 +109,7 @@ npm run test:ie
npm run test:watch
```

Watches changes to your application and reruns tests whenever a file changes.
Watches changes to your application and re-runs tests whenever a file changes.

### Remote testing

Expand Down
2 changes: 1 addition & 1 deletion docs/general/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

*Step 2:* Install the Node.js buildpack for your Heroku app by running the following command: `heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs#v91 -a [your app name]`. Make sure to replace `#v91` with whatever the latest buildpack is, which you can [find here](https://github.com/heroku/heroku-buildpack-nodejs/releases).

*Step 3:* Add this line to your `package.json` file in the scripts area: `"heroku-postbuild": "npm run build",`. This is so Heroku can build your production assets when deploying (more of which you can [read about here](https://devcenter.heroku.com/articles/nodejs-support#heroku-specific-build-steps)). Then, adjust the _prebuild_ script in your `package.json` file so it looks like this: `"prebuild": "npm run build:clean",` to avoid having Heroku attempt to run Karma tests (which are unsupported with this buildpack).
*Step 3:* Add this line to your `package.json` file in the scripts area: `"heroku-postbuild": "npm run build",`. This is so Heroku can build your production assets when deploying (more of which you can [read about here](https://devcenter.heroku.com/articles/nodejs-support#heroku-specific-build-steps)). Then, adjust the _prebuild_ script in your `package.json` file so it looks like this: `"prebuild": "npm run build:clean",` to avoid having Heroku attempt to run Jest tests (which are unsupported with this buildpack).

*Step 4:* Run `heroku config:set NPM_CONFIG_PRODUCTION=false` so that Heroku can compile the NPM modules included in your _devDependencies_ (since many of these packages are required for the build process).

Expand Down
2 changes: 1 addition & 1 deletion docs/testing/component-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Lets test our `<Button>` component! We're going to assess three things: First,
that it renders a HTML `<button>` tag, second that it renders its children we
pass it and third that handles clicks!

This is our Mocha setup:
This is our Jest setup:

```javascript
describe('<Button />', () => {
Expand Down
Loading

0 comments on commit 62b5d42

Please sign in to comment.