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: docs-app/filtering.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,25 @@ Ember Exam provides options to filter test suites by two types - module path and
6
6
$ ember exam --module-path=<module-path>
7
7
```
8
8
9
-
The `module-path` option allows you to filter module paths by a given value. Module paths are mapped by test files and they are generated during `ember build`. After the build, `tests.js` file is created and it resides under [build-directory]/assets. The file is combined of all tests in an application and it has a form of `define("<module-path>", others..`.
9
+
#### For Vite Apps
10
+
11
+
The `file-path` option allows you to filter modules by the given relative path that is generated from `import.meta.glob(...)` in your `tests/index.html`.
12
+
13
+
```bash
14
+
# This will run tests that are defined in `/my-application/tests/unit/my-test.js`
15
+
$ ember exam --file-path='/my-application/tests/unit/my-test.js'
16
+
17
+
# This will run all test files that are under `/my-application/tests/unit/`
18
+
$ ember exam --file-path='/my-application/tests/unit/*.js'
19
+
```
20
+
21
+
22
+
#### For non-Vite Apps
23
+
24
+
25
+
The `module-path` option allows you to filter module paths by a given value. Module paths are mapped by test files and they are generated during `ember build`. After the build, `tests.js` file is created and it resides under [build-directory]/assets.
26
+
27
+
The file is combined of all tests in an application and it has a form of `define("<module-path>", others..`.
10
28
11
29
The value for `module-path` can have either string or regular expression, for instance:
Copy file name to clipboardExpand all lines: docs-app/quickstart.md
+73-2Lines changed: 73 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,13 +35,84 @@ ember exam --load-balance --parallel --server --no-launch
35
35
36
36
The idea is that you can replace `ember test` with `ember exam` and never look back.
37
37
38
+
To get the unique features of Ember Exam (described in-depth below), you will need to **replace** the use of `start()` from `ember-qunit` in `test-helper.js` with `start()` from `ember-exam`:
39
+
40
+
41
+
## Setup
42
+
43
+
### With Vite
44
+
45
+
46
+
Update your test-helper.js or test-helper.ts, to have add the ember-exam `start` function:
47
+
```diff
48
+
// ...
49
+
import { setApplication } from '@ember/test-helpers';
50
+
import { setup } from 'qunit-dom';
51
+
- import { start as qunitStart, setupEmberOnerrorValidation } from 'ember-qunit';
52
+
+ import { setupEmberOnerrorValidation } from 'ember-qunit';
53
+
+ import { start as startEmberExam } from 'ember-exam/test-support';
54
+
55
+
- export function start() {
56
+
+ export async function start({ availableModules }) {
57
+
setApplication(Application.create(config.APP));
58
+
59
+
setup(QUnit.assert);
60
+
setupEmberOnerrorValidation();
61
+
62
+
- qunitStart();
63
+
+ // Options passed to `start` will be passed-through to ember-qunit
64
+
+ await startEmberExam({ availableModules });
65
+
}
66
+
```
67
+
68
+
Then, update your tests/index.html to pass availableModules to start:
We need to tell vite to build the app before telling ember/exam to run tests on that output.
84
+
85
+
Testing development:
86
+
```bash
87
+
NODE_ENV=development vite build --mode development
88
+
ember exam --path dist --config-file ./testem.cjs
89
+
```
90
+
91
+
Testing production:
92
+
```bash
93
+
vite build --mode test
94
+
ember exam --path dist --config-file ./testem.cjs
95
+
```
96
+
97
+
> [!NOTE]
98
+
> Specifying the `--path` is important because otherwise ember-cli will try to build your vite app, and it will error.
99
+
100
+
> [!NOTE]
101
+
> Specifying the `--config-path` is important because ember-cli (what backs ember-exam) doesn't know about cjs files.
102
+
103
+
104
+
### broccoli / ember-cli
105
+
106
+
38
107
To get the unique features of Ember Exam (described in-depth below), you will need to **replace** the use of `start()` from `ember-qunit` in `test-helper.js` with `start()` from `ember-exam`:
0 commit comments