ember-cli-code-coverage icon indicating copy to clipboard operation
ember-cli-code-coverage copied to clipboard

Exclude tests and in-repo* from being instrumented to improve build/test times

Open GCheung55 opened this issue 5 years ago • 4 comments

By default, only files in */mirage/**/* are excluded. While helpful, tests/ and test-support/, found in in-repo-addons and in-repo-engines, are not excluded, which contributes to the amount of time it takes to instrument files.

I propose to add the following globs to exclude from being instrumented:

  • */tests/**/* (All files under the app's tests/ folder)
  • */lib/**/test-support/**/* (All files under the in-repo-engine or in-repo-addon test-support/ folder)

GCheung55 avatar Aug 07 '20 19:08 GCheung55

@GCheung55 I think I would be fine with this, however, isn't this already achievable with the current excludes config and manually adding those values?

RobbieTheWagner avatar Aug 08 '20 15:08 RobbieTheWagner

@rwwagner90 it is already achievable, but what I’m proposing is adding the globs as a default which reduces manual configuration and and improves performance for large apps out of the box.

GCheung55 avatar Aug 09 '20 07:08 GCheung55

@GCheung55 will doing this effect code coverage amounts at all? I'm not really sure how it all works.

RobbieTheWagner avatar Aug 09 '20 16:08 RobbieTheWagner

/lib//test-support// (All files under the in-repo-engine or in-repo-addon test-support/ folder)

Generally, I think this is fine, but we shouldn't use this exact glob as written. We should build up the paths for each of the actually known addons's folders. Something like:

function gatherExcludePaths(addon, excludes = new Set()) {
  excludes.add(path.join(addon.treePathFor('test-support'), '**/*'));

  addon.addons.forEach((child) => gatherExcludePaths(child, excludes));

  return excludes;
}

// ...snip...
let excludes = gatherExcludePaths(project);

rwjblue avatar Sep 22 '20 15:09 rwjblue