You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/release/testing/index.md
+4-30Lines changed: 4 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,46 +14,20 @@ Writing tests is also a fun activity, a nice change of pace from delivering feat
14
14
15
15
You have a few options for running tests.
16
16
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.
18
18
19
19
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.
20
20
21
21
```bash
22
22
# Run all tests once
23
-
ember test
24
-
ember t
23
+
npm test
25
24
```
26
25
27
26
### How to Filter Tests
28
27
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.
30
29
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.
`module` allows you to scope your tests: Any test setup that is done inside of this scope will
26
26
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
+
29
30
`setupApplicationTest` deals with application setup and teardown.
0 commit comments