Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,12 @@ be relative to your project root.
const app = new EmberApp(defaults, {
'ember-cli-code-coverage': {
modifyAssetLocation(root, relativePath) {
// here is an example of saying that `component/foo.js` actually
// lives in `lib/common/app/foo.js` on disk.
if (fs.existsSync(path.join(root, 'lib/inrepo/app', relativePath))) {
return path.join('lib/common/app', relativePath);
let appPath = relativePath.replace('my-project-name', 'app');

// here is an example of saying that `app/components/foo.js` actually
// lives in `lib/inrepo/app/components/foo.js` on disk.
if (fs.existsSync(path.join(root, 'lib/inrepo', appPath))) {
return path.join('lib/inrepo', appPath);
}

return false;
Expand Down
96 changes: 87 additions & 9 deletions test-packages/__snapshots__/in-repo-addon-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,84 @@ Object {
"total": 1,
},
},
"lib/my-in-repo-addon/app/utils/my-covered-util.js": Object {
"branches": Object {
"covered": 0,
"pct": 0,
"skipped": 0,
"total": 0,
},
"functions": Object {
"covered": 0,
"pct": 0,
"skipped": 0,
"total": 0,
},
"lines": Object {
"covered": 0,
"pct": 0,
"skipped": 0,
"total": 0,
},
"statements": Object {
"covered": 0,
"pct": 0,
"skipped": 0,
"total": 0,
},
},
"lib/my-in-repo-addon/app/utils/my-in-repo-addon-app-covered-util.js": Object {
"branches": Object {
"covered": 0,
"pct": 100,
"skipped": 0,
"total": 0,
},
"functions": Object {
"covered": 1,
"pct": 100,
"skipped": 0,
"total": 1,
},
"lines": Object {
"covered": 1,
"pct": 100,
"skipped": 0,
"total": 1,
},
"statements": Object {
"covered": 1,
"pct": 100,
"skipped": 0,
"total": 1,
},
},
"lib/my-in-repo-addon/app/utils/my-uncovered-util.js": Object {
"branches": Object {
"covered": 0,
"pct": 0,
"skipped": 0,
"total": 0,
},
"functions": Object {
"covered": 0,
"pct": 0,
"skipped": 0,
"total": 0,
},
"lines": Object {
"covered": 0,
"pct": 0,
"skipped": 0,
"total": 0,
},
"statements": Object {
"covered": 0,
"pct": 0,
"skipped": 0,
"total": 0,
},
},
"total": Object {
"branches": Object {
"covered": 0,
Expand All @@ -244,22 +322,22 @@ Object {
"total": 2,
},
"functions": Object {
"covered": 3,
"pct": 33.33,
"covered": 4,
"pct": 40,
"skipped": 0,
"total": 9,
"total": 10,
},
"lines": Object {
"covered": 8,
"pct": 47.06,
"covered": 9,
"pct": 50,
"skipped": 0,
"total": 17,
"total": 18,
},
"statements": Object {
"covered": 8,
"pct": 47.06,
"covered": 9,
"pct": 50,
"skipped": 0,
"total": 17,
"total": 18,
},
},
}
Expand Down
13 changes: 13 additions & 0 deletions test-packages/my-app-with-in-repo-addon/ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict';

const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const fs = require('fs');
const path = require('path');

module.exports = function(defaults) {
let app = new EmberApp(defaults, {
Expand All @@ -9,6 +11,17 @@ module.exports = function(defaults) {
...require('ember-cli-code-coverage').buildBabelPlugin(),
],
},
'ember-cli-code-coverage': {
modifyAssetLocation(root, relativePath) {
let appPath = relativePath.replace('my-app-with-in-repo-addon', 'app');

if (!fs.existsSync(appPath) && fs.existsSync(path.join(root, 'lib/my-in-repo-addon', appPath))) {
return path.join('lib/my-in-repo-addon', appPath);
}

return false;
}
}
});

// Use `app.import` to add additional libraries to the generated
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function myInRepoAddonAppCoveredUtil() {
return true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import myInRepoAddonAppCoveredUtil from 'my-app-with-in-repo-addon/utils/my-in-repo-addon-app-covered-util';
import { module, test } from 'qunit';

module('Unit | Utility | my in repo addon app covered util');

// Replace this with your real tests.
test('it works', function(assert) {
let result = myInRepoAddonAppCoveredUtil();
assert.ok(result);
});