Skip to content

Commit 6860bee

Browse files
authored
Merge pull request #755 from ember-cli/ember-cli-test
Add a test that covers addon templates and fix ember-try to include correct ember-cli versions
2 parents d5aa14b + 1b9e019 commit 6860bee

File tree

8 files changed

+2395
-252
lines changed

8 files changed

+2395
-252
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
runs-on: ${{ matrix.os }}-latest
3232

3333
strategy:
34+
fail-fast: false
3435
matrix:
3536
os: [ubuntu, windows]
3637
node-version: [12.x, 14.x]
@@ -73,9 +74,12 @@ jobs:
7374
needs: [test, lint]
7475

7576
strategy:
77+
fail-fast: false
7678
matrix:
7779
ember-try-scenario:
7880
- ember-lts-3.8
81+
- ember-lts-3.12
82+
- ember-lts-3.16
7983
- ember-lts-3.20
8084
- ember-lts-3.24
8185
- ember-lts-3.28

config/ember-try.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@ module.exports = async function () {
1212
npm: {
1313
devDependencies: {
1414
'ember-source': '~3.8.0',
15+
'ember-cli': '~3.8.0',
16+
},
17+
},
18+
},
19+
{
20+
name: 'ember-lts-3.12',
21+
npm: {
22+
devDependencies: {
23+
'ember-source': '~3.12.0',
24+
'ember-cli': '~3.12.0',
25+
},
26+
},
27+
},
28+
{
29+
name: 'ember-lts-3.16',
30+
npm: {
31+
devDependencies: {
32+
'ember-source': '~3.16.0',
33+
'ember-cli': '~3.16.0',
1534
},
1635
},
1736
},
@@ -20,6 +39,7 @@ module.exports = async function () {
2039
npm: {
2140
devDependencies: {
2241
'ember-source': '~3.20.5',
42+
'ember-cli': '~3.20.0',
2343
},
2444
},
2545
},
@@ -28,6 +48,7 @@ module.exports = async function () {
2848
npm: {
2949
devDependencies: {
3050
'ember-source': '~3.24.3',
51+
'ember-cli': '~3.24.0',
3152
},
3253
},
3354
},
@@ -36,6 +57,7 @@ module.exports = async function () {
3657
npm: {
3758
devDependencies: {
3859
'ember-source': '~3.28.0',
60+
'ember-cli': '~3.28.0',
3961
},
4062
},
4163
},

lib/ember-addon-main.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,36 @@ module.exports = {
9696
}
9797

9898
this._addon.logger.debug(`setup *.hbs compiler with ${htmlbarsOptions.pluginNames}`);
99-
return debugTree(
99+
let output = debugTree(
100100
this._addon.transpileTree(inputTree, {
101101
isProduction,
102102
...htmlbarsOptions,
103103
}),
104104
'03-output'
105105
);
106+
107+
let checker = new VersionChecker(this._addon.project).for('ember-cli', 'npm');
108+
let requiresBabelTree = checker.lt('3.13.0');
109+
let isAddon = this._addon.parent !== this._addon.project;
110+
111+
// as a result of https://github.com/ember-cli/ember-cli-htmlbars/pull/749 we are relying
112+
// on babel for all template comilation. This works fine since [email protected] but before
113+
// that there was a different path for **addon** templates and they would not be compiled
114+
// correctly. This change wraps the output of addons in a babel tree since ember-cli
115+
// isn't doing that properly.
116+
if (requiresBabelTree && isAddon) {
117+
let babelAddon = this._addon.parent.addons.find(
118+
(addon) => addon.name === 'ember-cli-babel'
119+
);
120+
output = babelAddon.transpileTree(output, {
121+
babel: this._addon.parent.options.babel,
122+
'ember-cli-babel': {
123+
compileModules: false,
124+
},
125+
});
126+
}
127+
128+
return output;
106129
},
107130

108131
precompile(string, _options) {

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"ember-resolver": "^8.0.2",
8080
"ember-source": "~3.28.0",
8181
"ember-source-channel-url": "^3.0.0",
82+
"ember-styleguide": "^5.0.0",
8283
"ember-template-lint": "^3.6.0",
8384
"ember-try": "^1.4.0",
8485
"eslint": "^7.32.0",
@@ -109,6 +110,9 @@
109110
"main": "lib/ember-addon-main.js",
110111
"configPath": "tests/dummy/config"
111112
},
113+
"resolutions": {
114+
"ember-cli-htmlbars": "link:."
115+
},
112116
"release-it": {
113117
"plugins": {
114118
"release-it-lerna-changelog": {

tests/acceptance/styleguide-test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { module, test } from 'qunit';
2+
import { visit, currentURL } from '@ember/test-helpers';
3+
import { setupApplicationTest } from 'ember-qunit';
4+
5+
module('Acceptance | styleguide', function (hooks) {
6+
setupApplicationTest(hooks);
7+
8+
test('visiting /styleguide', async function (assert) {
9+
await visit('/styleguide');
10+
11+
assert.equal(currentURL(), '/styleguide');
12+
13+
assert.dom('[data-test-es-note-heading]').containsText('says...');
14+
});
15+
});

tests/dummy/app/router.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const Router = EmberRouter.extend({
66
rootURL: config.rootURL,
77
});
88

9-
Router.map(function () {});
9+
Router.map(function () {
10+
this.route('styleguide');
11+
});
1012

1113
export default Router;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<EsNote>You should try out this cool note component</EsNote>

0 commit comments

Comments
 (0)