Skip to content

Instantly share code, notes, and snippets.

@ppcano
Created February 28, 2019 12:24
Show Gist options
  • Save ppcano/78e14886c7a660d17eadab709802adb0 to your computer and use it in GitHub Desktop.
Save ppcano/78e14886c7a660d17eadab709802adb0 to your computer and use it in GitHub Desktop.
diff --git i/lib/broccoli/default-packager.js w/lib/broccoli/default-packager.js
index 1228226ee..af184f6db 100644
--- i/lib/broccoli/default-packager.js
+++ w/lib/broccoli/default-packager.js
@@ -845,46 +845,33 @@ module.exports = class DefaultPackager {
annotation: 'Tests To Process',
});
-
if (this.isModuleUnificationEnabled) {
let destDir,
- testSrcTree,
- srcDir,
- dirNotFound;
+ testSrcTree;
// ember-addon
if (this.name === 'dummy') {
- testSrcTree = 'src';
+ // Search the addon folder to find inline tests (src/components/hola/component-test.js)
+ testSrcTree = this.project.root;
destDir = `${this.project.name()}/src`;
- // Classic Addon with MU dummy app `kitchen-sink-with-mu-dummy-app` will throw: `Dir not found: src` exception
- // `dirNotFound` will skip this error. Find better way to avoid this error.
-
- // also, in tests we pass root path to this function
- // in default-packager/tests-test.js
- const srcPath = typeof tree === 'string' ? `${tree}/src` : 'src';
- dirNotFound = !fs.existsSync(srcPath);
} else {
testSrcTree = tree;
destDir = `${this.name}/src`;
- srcDir = 'src';
}
- if (!dirNotFound) {
- testSrcTree = new Funnel(testSrcTree, {
- srcDir,
- include: ['**/*-test.{js,ts}'],
- annotation: 'Module Unification Tests',
- });
-
- testSrcTree = new Funnel(testSrcTree, {
- destDir,
- });
+ testSrcTree = new Funnel(testSrcTree, {
+ srcDir: 'src',
+ // allowEmpty in order a MU app can run inside a Classic addon
+ allowEmpty: true,
+ include: ['**/*-test.{js,ts}'],
+ destDir,
+ annotation: 'Module Unification Tests',
+ });
- treeToCompile = mergeTrees([treeToCompile, testSrcTree], {
- annotation: 'Merge MU Tests',
- });
- }
+ treeToCompile = mergeTrees([treeToCompile, testSrcTree], {
+ annotation: 'Merge MU Tests',
+ });
}
treeToCompile = callAddonsPreprocessTreeHook(this.project, 'test', treeToCompile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment