Skip to content

Commit c8607d2

Browse files
committed
Merge branch 'master' into node-acceptance-tests
2 parents 9f00685 + 54efd3f commit c8607d2

File tree

22 files changed

+456
-350
lines changed

22 files changed

+456
-350
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/blueprints/*/files/**/*.js

.eslintrc.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ module.exports = {
1414
// node files
1515
{
1616
files: [
17+
'ember-cli-build.js',
1718
'index.js',
1819
'testem.js',
19-
'ember-cli-build.js',
20+
'blueprints/*/index.js',
2021
'config/**/*.js',
2122
'tests/dummy/config/**/*.js',
2223
'lib/**/*.js',
@@ -34,7 +35,7 @@ module.exports = {
3435
plugins: ['node'],
3536
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
3637
// add your custom rules and overrides for node files here
37-
'ember/avoid-leaking-state-in-ember-objects': 'off'
38+
'ember/avoid-leaking-state-in-ember-objects': 'off',
3839
}),
3940
},
4041

@@ -54,8 +55,8 @@ module.exports = {
5455
mocha: true,
5556
},
5657
rules: {
57-
'node/no-unpublished-require': 'off'
58-
}
58+
'node/no-unpublished-require': 'off',
59+
},
5960
},
6061
],
6162
};

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ env:
2020
# as well as latest stable release (bonus points to beta/canary)
2121
- EMBER_TRY_SCENARIO=ember-lts-2.12
2222
- EMBER_TRY_SCENARIO=ember-lts-2.16
23+
- EMBER_TRY_SCENARIO=ember-lts-2.18
2324
- EMBER_TRY_SCENARIO=ember-release
2425
- EMBER_TRY_SCENARIO=ember-beta
2526
- EMBER_TRY_SCENARIO=ember-canary

blueprints/-addon-import.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-env node */
12
'use strict';
23

34
var stringUtil = require('ember-cli-string-utils');

blueprints/test-framework-detector.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-env node */
12
'use strict';
23

34
const fs = require('fs');

config/ember-try.js

Lines changed: 71 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,80 @@
1-
module.exports = {
2-
useYarn: true,
3-
scenarios: [
4-
{
5-
name: 'integrated-node-tests',
6-
command: 'yarn nodetest',
7-
npm: {
8-
devDependencies: {
9-
'ember-cli-qunit': null,
1+
'use strict';
2+
3+
const getChannelURL = require('ember-source-channel-url');
4+
5+
module.exports = function() {
6+
return Promise.all([
7+
getChannelURL('release'),
8+
getChannelURL('beta'),
9+
getChannelURL('canary'),
10+
]).then(urls => {
11+
return {
12+
useYarn: true,
13+
scenarios: [
14+
{
15+
name: 'integrated-node-tests',
16+
command: 'yarn nodetest',
17+
npm: {
18+
devDependencies: {
19+
'ember-cli-qunit': null,
20+
},
21+
},
1022
},
11-
},
12-
},
13-
{
14-
name: 'ember-lts-2.12',
15-
npm: {
16-
devDependencies: {
17-
'ember-source': '~2.12.0',
23+
{
24+
name: 'ember-lts-2.12',
25+
npm: {
26+
devDependencies: {
27+
'ember-source': '~2.12.0',
28+
},
29+
},
1830
},
19-
},
20-
},
21-
{
22-
name: 'ember-lts-2.16',
23-
npm: {
24-
devDependencies: {
25-
'ember-source': '~2.16.0',
31+
{
32+
name: 'ember-lts-2.16',
33+
npm: {
34+
devDependencies: {
35+
'ember-source': '~2.16.0',
36+
},
37+
},
2638
},
27-
},
28-
},
29-
{
30-
name: 'ember-release',
31-
bower: {
32-
dependencies: {
33-
ember: 'components/ember#release',
39+
{
40+
name: 'ember-lts-2.18',
41+
npm: {
42+
devDependencies: {
43+
'ember-source': '~2.18.0',
44+
},
45+
},
3446
},
35-
resolutions: {
36-
ember: 'release',
47+
{
48+
name: 'ember-release',
49+
npm: {
50+
devDependencies: {
51+
'ember-source': urls[0],
52+
},
53+
},
3754
},
38-
},
39-
npm: {
40-
devDependencies: {
41-
'ember-source': null,
55+
{
56+
name: 'ember-beta',
57+
npm: {
58+
devDependencies: {
59+
'ember-source': urls[1],
60+
},
61+
},
4262
},
43-
},
44-
},
45-
{
46-
name: 'ember-beta',
47-
bower: {
48-
dependencies: {
49-
ember: 'components/ember#beta',
63+
{
64+
name: 'ember-canary',
65+
npm: {
66+
devDependencies: {
67+
'ember-source': urls[2],
68+
},
69+
},
5070
},
51-
resolutions: {
52-
ember: 'beta',
71+
{
72+
name: 'ember-default',
73+
npm: {
74+
devDependencies: {},
75+
},
5376
},
54-
},
55-
npm: {
56-
devDependencies: {
57-
'ember-source': null,
58-
},
59-
},
60-
},
61-
{
62-
name: 'ember-canary',
63-
bower: {
64-
dependencies: {
65-
ember: 'components/ember#canary',
66-
},
67-
resolutions: {
68-
ember: 'canary',
69-
},
70-
},
71-
npm: {
72-
devDependencies: {
73-
'ember-source': null,
74-
},
75-
},
76-
},
77-
{
78-
name: 'ember-default',
79-
npm: {
80-
devDependencies: {},
81-
},
82-
},
83-
],
77+
],
78+
};
79+
});
8480
};

lib/incremental-typescript-compiler/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,11 @@ module.exports = class IncrementalTypescriptCompiler {
9797

9898
this._watchProgram = compile(project, { outDir, watch: true }, {
9999
watchedFileChanged: () => this.state.tscDidStart(),
100+
buildComplete: () => this.state.tscDidEnd(),
100101

101102
reportWatchStatus: (diagnostic) => {
102103
let text = diagnostic.messageText;
103104
debugTsc(text);
104-
105-
if (text.indexOf('Compilation complete') !== -1) {
106-
this.state.tscDidEnd();
107-
}
108105
},
109106

110107
reportDiagnostic: (diagnostic) => {

lib/utilities/compile.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,37 @@ module.exports = function compile(project, tsOptions, callbacks) {
1919
}, tsOptions);
2020

2121
let ts = project.require('typescript');
22+
let host = createWatchCompilerHost(ts, fullOptions, project, callbacks);
23+
24+
return ts.createWatchProgram(host);
25+
};
26+
27+
function createWatchCompilerHost(ts, options, project, callbacks) {
2228
let configPath = ts.findConfigFile('./', ts.sys.fileExists, 'tsconfig.json');
2329
let createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;
2430
let host = ts.createWatchCompilerHost(
2531
configPath,
26-
fullOptions,
32+
options,
2733
buildWatchHooks(project, ts.sys, callbacks),
2834
createProgram,
2935
diagnosticCallback(callbacks.reportDiagnostic),
3036
diagnosticCallback(callbacks.reportWatchStatus)
3137
);
3238

39+
let afterCreate = host.afterProgramCreate;
40+
host.afterProgramCreate = function() {
41+
afterCreate.apply(this, arguments);
42+
if (callbacks.buildComplete) {
43+
callbacks.buildComplete();
44+
}
45+
};
46+
3347
if (debug.enabled) {
3448
host.trace = str => debug(str.trim());
3549
}
3650

37-
return ts.createWatchProgram(host);
38-
};
51+
return host;
52+
}
3953

4054
function diagnosticCallback(callback) {
4155
if (callback) {

node-tests/blueprints/component-test-test.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,9 @@ describe('Blueprint: component-test', function() {
3838
});
3939
});
4040

41-
describe('with usePods=true', function() {
42-
beforeEach(function() {
43-
fs.writeFileSync(
44-
'.ember-cli',
45-
`{
46-
"disableAnalytics": false,
47-
"usePods": true
48-
}`
49-
);
50-
});
51-
41+
describe('with --pod', function() {
5242
it('component-test x-foo', function() {
53-
return emberGenerateDestroy(['component-test', 'x-foo'], _file => {
43+
return emberGenerateDestroy(['--pod', 'component-test', 'x-foo'], _file => {
5444
expect(_file('tests/integration/components/x-foo/component-test.ts')).to.equal(
5545
fixture('component-test/default.ts')
5646
);

node-tests/fixtures/acceptance-test/mocha.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, it, beforeEach, afterEach } from 'mocha';
22
import { expect } from 'chai';
33
import startApp from 'my-app/tests/helpers/start-app';
4-
import destroyApp from 'my-app/tests/helpers/destroy-app';
4+
import { run } from '@ember/runloop';
55

66
describe('Acceptance | foo', function() {
77
let application;
@@ -11,7 +11,7 @@ describe('Acceptance | foo', function() {
1111
});
1212

1313
afterEach(function() {
14-
destroyApp(application);
14+
run(application, 'destroy');
1515
});
1616

1717
it('can visit /foo', function() {

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
"homepage": "https://github.com/typed-ember/ember-cli-typescript",
2525
"scripts": {
2626
"build": "ember build",
27-
"lint:js": "eslint ./*.js blueprints/*/index.js addon addon-test-support app config lib server test-support tests node-tests",
27+
"lint:js": "eslint ./*.js addon addon-test-support app blueprints config lib server test-support tests",
2828
"start": "ember serve",
29-
"test": "ember try:each",
30-
"nodetest": "mocha node-tests --recursive"
29+
"test": "ember test",
30+
"nodetest": "mocha node-tests --recursive",
31+
"test:all": "ember try:each"
3132
},
3233
"dependencies": {
3334
"broccoli-debug": "^0.6.4",
@@ -67,7 +68,7 @@
6768
"@types/qunit": "^2.0.31",
6869
"broccoli-asset-rev": "^2.6.0",
6970
"co": "^4.6.0",
70-
"ember-cli": "~2.18.2",
71+
"ember-cli": "~3.1.4",
7172
"ember-cli-app-version": "^3.1.3",
7273
"ember-cli-babel": "^6.6.0",
7374
"ember-cli-blueprint-test-helpers": "^0.18.3",
@@ -85,11 +86,14 @@
8586
"ember-disable-prototype-extensions": "^1.1.2",
8687
"ember-export-application-global": "^2.0.0",
8788
"ember-load-initializers": "^1.0.0",
89+
"ember-maybe-import-regenerator": "^0.1.6",
8890
"ember-resolver": "^4.5.0",
89-
"ember-source": "~2.18.0",
91+
"ember-source": "~3.1.0",
92+
"ember-source-channel-url": "^1.0.1",
93+
"ember-try": "^0.2.23",
9094
"eslint": "^4.17.0",
9195
"eslint-plugin-ember": "^5.0.3",
92-
"eslint-plugin-node": "^6.0.0",
96+
"eslint-plugin-node": "^6.0.1",
9397
"esprima": "^4.0.0",
9498
"loader.js": "^4.2.3",
9599
"mktemp": "^0.4.0",

tests/dummy/config/targets.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
'use strict';
2+
3+
const browsers = [
4+
'last 1 Chrome versions',
5+
'last 1 Firefox versions',
6+
'last 1 Safari versions'
7+
];
8+
9+
const isCI = !!process.env.CI;
10+
const isProduction = process.env.EMBER_ENV === 'production';
11+
12+
if (isCI || isProduction) {
13+
browsers.push('ie 11');
14+
}
15+
116
module.exports = {
2-
browsers: ['ie 9', 'last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions'],
17+
browsers
318
};

tests/helpers/.gitkeep

Whitespace-only changes.

tests/helpers/destroy-app.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/helpers/module-for-acceptance.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)