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: README.md
+21-17Lines changed: 21 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -158,6 +158,8 @@ Configuration is optional. It should be put in a file at `config/coverage.js` (`
158
158
159
159
-`parallel`: Defaults to `false`. Should be set to true if parallel testing is being used for separate test runs, for example when using [ember-exam](https://github.com/trentmwillis/ember-exam) with the `--partition` flag. This will generate the coverage reports in directories suffixed with `_<random_string>` to avoid overwriting other threads reports. These reports can be joined by using the `ember coverage-merge` command (potentially as part of the [posttest hook](https://docs.npmjs.com/misc/scripts) in your `package.json`).
160
160
161
+
-`modifyAssetLocation`: Optional function that will allow you to override where a file actually lives inside of your project. See [Advanced customization](#modifyassetlocation) on how to use this function in practice.
162
+
161
163
#### Example
162
164
```js
163
165
module.exports= {
@@ -190,7 +192,9 @@ If you are using [`ember-cli-pretender`](https://github.com/rwjblue/ember-cli-pr
190
192
191
193
## Advanced customization
192
194
193
-
The `forceModulesToBeLoaded` can potientally cause unindented side effects when executed. You can pass custom filter fuctions that allow
195
+
### `forceModulesToBeLoaded`
196
+
197
+
The `forceModulesToBeLoaded` function can potentially cause unintended side effects when executed. You can pass custom filter fuctions that allow
194
198
you to specify which modules will be force loaded or not:
195
199
196
200
```js
@@ -201,28 +205,28 @@ QUnit.done(async () => {
201
205
});
202
206
```
203
207
208
+
### `modifyAssetLocation`
209
+
204
210
Under the hood, `ember-cli-code-coverage` attempts to "de-namespacify" paths into their real on disk location inside of
205
211
`project.root` (ie give a namespaced path like lib/inrepo/components/foo.js would live in lib/inrepo/addon/components/foo.js). It makes
206
212
some assumptions (where files live in in-repo addons vs app code for example) and sometimes those assumptions might not hold. Passing a
207
-
function `modifyAssetLocation` will allow you to override where a file actually lives inside of your project. The returned string should
208
-
be relative to your project root.
213
+
function `modifyAssetLocation`in your [configuration file](#configuration)will allow you to override where a file actually lives inside
214
+
of your project. The returned string should be relative to your project root.
209
215
210
216
```js
211
-
constapp=newEmberApp(defaults, {
212
-
'ember-cli-code-coverage': {
213
-
modifyAssetLocation(root, relativePath) {
214
-
let appPath =relativePath.replace('my-project-name', 'app');
215
-
216
-
// here is an example of saying that `app/components/foo.js` actually
217
-
// lives in `lib/inrepo/app/components/foo.js` on disk.
218
-
if (fs.existsSync(path.join(root, 'lib/inrepo', appPath))) {
219
-
returnpath.join('lib/inrepo', appPath);
220
-
}
221
-
222
-
returnfalse;
223
-
},
217
+
module.exports= {
218
+
modifyAssetLocation(root, relativePath) {
219
+
let appPath =relativePath.replace('my-project-name', 'app');
220
+
221
+
// here is an example of saying that `app/components/foo.js` actually
222
+
// lives in `lib/inrepo/app/components/foo.js` on disk.
223
+
if (fs.existsSync(path.join(root, 'lib', 'inrepo', appPath))) {
0 commit comments