Skip to content

Commit 5d5ea87

Browse files
authored
Merge pull request #2164 from ember-learn/update-ember-test
update cases of `ember test`
2 parents 2bc1b3c + fc78791 commit 5d5ea87

File tree

2 files changed

+7
-32
lines changed

2 files changed

+7
-32
lines changed

guides/release/testing/index.md

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,20 @@ Writing tests is also a fun activity, a nice change of pace from delivering feat
1414

1515
You have a few options for running tests.
1616

17-
First, you can run the test suite by entering the command `ember test`, or `ember t`, in your terminal. This will run the suite just once.
17+
First, you can run the test suite by entering the command `npm test` in your terminal. This will run the suite just once using the test command that is specified in your `package.json` `scripts.test` entry.
1818

1919
Running a local development server (through `npm start`), you can visit the `/tests` URI. This will render the `tests/index.html` template. This will also auto-update as you are changing files in your app.
2020

2121
```bash
2222
# Run all tests once
23-
ember test
24-
ember t
23+
npm test
2524
```
2625

2726
### How to Filter Tests
2827

29-
When you are working on a single component or page, you will want only a small subset of tests to run after every file change. To specify which tests to run, you can add `--module` or `--filter` option to your command.
28+
When you start your development server and navigate to `/tests` you will be presented with the QUnit interface. At the top of that page you will see a `Filter` input that you can use to run a smaller subset of your tests.
3029

31-
The `--module` option allows you to select a **module**—a group of tests that you specified in `module()` in QUnit.
32-
33-
```bash
34-
# Button component example
35-
ember test --module="Integration | Component | simple-button"
36-
37-
# Run tests for a location service
38-
ember t -m="Unit | Service | location"
39-
```
40-
41-
The `--filter` option is more versatile. You can provide a phrase to match against the modules and test descriptions. A test description is what appears in `test()` in QUnit.
42-
43-
```bash
44-
# Button component example
45-
ember test --filter="should show icon and label"
46-
47-
# Test everything related to your dashboard
48-
ember t -f="Dashboard"
49-
50-
# Run integration tests
51-
ember t -f="Integration"
52-
```
53-
54-
In QUnit, you can exclude tests by adding an exclamation point to the beginning of the filter, e.g. `ember test --filter="!Acceptance"`.
55-
56-
To learn more about options for testing, you can visit [Ember CLI Documentation](https://ember-cli.com/testing) or type `ember help test` in the command line.
30+
You can also click the `Rerun` link beside any of the tests listed in QUnit interface to just rerun that one test. This is especially useful if you are working on a single component and want to run the corresponding unit or integration tests while you develop that component.
5731

5832
## How to Debug Tests
5933

guides/release/testing/testing-application.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ module('Acceptance | login', function(hooks) {
2424

2525
`module` allows you to scope your tests: Any test setup that is done inside of this scope will
2626
apply to all test cases contained in this module.
27-
Scoping your tests with `module` also allows you to execute your tests independently from other tests.
28-
For example, to only run your tests from your `login` module, run `ember test --module='Acceptance | login'`.
27+
28+
Scoping your tests with `module` also allows you to execute your tests separately from other tests. The QUnit interface shows you a dropdown once you are running your tests that allows you to pick from available modules and filter tests down to the set that you have selected.
29+
2930
`setupApplicationTest` deals with application setup and teardown.
3031
The `test` function contains an example test.
3132

0 commit comments

Comments
 (0)