Skip to content

Commit bfd4739

Browse files
authored
Merge branch 'master' into blueprint-style
2 parents 875fecd + 11bee88 commit bfd4739

File tree

5 files changed

+179
-89
lines changed

5 files changed

+179
-89
lines changed

commitlint.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-env node */
2+
'use strict';
3+
4+
module.exports = {
5+
extends: ['@commitlint/config-conventional'],
6+
rules: {
7+
'header-max-length': [0, 'always', 288],
8+
},
9+
};

package.json

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"@commitlint/config-conventional": "8.2.0",
5959
"@ember/optional-features": "1.1.0",
6060
"@typed-ember/renovate-config": "1.2.1",
61-
"@types/chai": "4.2.5",
61+
"@types/capture-console": "1.0.0",
62+
"@types/chai": "4.2.6",
6263
"@types/chai-as-promised": "7.1.2",
6364
"@types/console-ui": "2.2.3",
6465
"@types/core-object": "3.0.1",
@@ -75,9 +76,10 @@
7576
"@types/resolve": "0.0.8",
7677
"@types/semver": "6.2.0",
7778
"@types/tmp": "0.1.0",
78-
"@typescript-eslint/eslint-plugin": "2.9.0",
79-
"@typescript-eslint/parser": "2.9.0",
79+
"@typescript-eslint/eslint-plugin": "2.10.0",
80+
"@typescript-eslint/parser": "2.10.0",
8081
"broccoli-asset-rev": "3.0.0",
82+
"capture-console": "1.0.1",
8183
"co": "4.6.0",
8284
"commitlint-azure-pipelines-cli": "1.0.2",
8385
"conventional-changelog-cli": "2.0.28",
@@ -92,21 +94,21 @@
9294
"ember-cli-deploy-build": "2.0.0",
9395
"ember-cli-deploy-git": "1.3.4",
9496
"ember-cli-deploy-git-ci": "1.0.1",
95-
"ember-cli-htmlbars": "4.0.8",
97+
"ember-cli-htmlbars": "4.0.9",
9698
"ember-cli-htmlbars-inline-precompile": "3.0.1",
9799
"ember-cli-inject-live-reload": "2.0.2",
98100
"ember-cli-release": "0.2.9",
99101
"ember-cli-sri": "2.1.1",
100102
"ember-cli-typescript-blueprints": "3.0.0",
101103
"ember-cli-uglify": "3.0.0",
102-
"ember-cli-update": "0.46.5",
104+
"ember-cli-update": "0.46.6",
103105
"ember-disable-prototype-extensions": "1.1.3",
104106
"ember-export-application-global": "2.0.1",
105107
"ember-load-initializers": "2.1.1",
106108
"ember-maybe-import-regenerator": "0.1.6",
107109
"ember-qunit": "4.6.0",
108110
"ember-resolver": "6.0.0",
109-
"ember-source": "3.14.2",
111+
"ember-source": "3.14.3",
110112
"ember-try": "1.3.0",
111113
"eslint": "6.7.2",
112114
"eslint-plugin-ember": "7.7.1",
@@ -126,7 +128,7 @@
126128
"testdouble": "3.12.4",
127129
"tmp": "0.1.0",
128130
"ts-node": "8.5.4",
129-
"typescript": "3.7.2"
131+
"typescript": "3.7.3"
130132
},
131133
"resolutions": {
132134
"@types/ember": "3.1.1",
@@ -148,18 +150,6 @@
148150
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
149151
}
150152
},
151-
"commitlint": {
152-
"extends": [
153-
"@commitlint/config-conventional"
154-
],
155-
"rules": {
156-
"header-max-length": [
157-
0,
158-
"always",
159-
288
160-
]
161-
}
162-
},
163153
"prettier": {
164154
"printWidth": 100,
165155
"semi": true,

ts/lib/commands/precompile.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,27 @@ export default command({
2525
return;
2626
}
2727

28-
// prettier-ignore
29-
await execa('tsc', [
30-
'--allowJs', 'false',
31-
'--noEmit', 'false',
32-
'--rootDir', rootDir || this.project.root,
33-
'--isolatedModules', 'false',
34-
'--declaration',
35-
'--declarationDir', outDir,
36-
'--emitDeclarationOnly',
37-
], {
38-
preferLocal: true
39-
});
28+
try {
29+
// prettier-ignore
30+
await execa('tsc', [
31+
'--allowJs', 'false',
32+
'--noEmit', 'false',
33+
'--rootDir', rootDir || this.project.root,
34+
'--isolatedModules', 'false',
35+
'--declaration',
36+
'--declarationDir', outDir,
37+
'--emitDeclarationOnly',
38+
'--pretty', 'true',
39+
], {
40+
preferLocal: true,
41+
42+
// Capture a string with stdout and stderr interleaved for error reporting
43+
all: true,
44+
});
45+
} catch (e) {
46+
console.error(`\n${e.all}\n`);
47+
throw e;
48+
}
4049

4150
let manifestPath = options.manifestPath;
4251
let packageName = this.project.pkg.name;

ts/tests/commands/precompile-test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as fs from 'fs-extra';
2-
2+
import { hook } from 'capture-console';
33
import ember from 'ember-cli-blueprint-test-helpers/lib/helpers/ember';
44
import blueprintHelpers from 'ember-cli-blueprint-test-helpers/helpers';
55
const setupTestHooks = blueprintHelpers.setupTestHooks;
@@ -38,6 +38,24 @@ describe('Acceptance: ts:precompile command', function() {
3838
expect(declaration).not.to.exist;
3939
});
4040

41+
it('emits errors to the console when precompilation fails', async () => {
42+
fs.ensureDirSync('app');
43+
fs.writeFileSync('app/test-file.ts', `export const testString: string = 123;`);
44+
45+
let output = '';
46+
let unhookStdout = hook(process.stdout, { quiet: true }, chunk => (output += chunk));
47+
let unhookStderr = hook(process.stderr, { quiet: true }, chunk => (output += chunk));
48+
try {
49+
await ember(['ts:precompile']);
50+
expect.fail('Precompilation should have failed');
51+
} catch {
52+
expect(output).to.include(`Type '123' is not assignable to type 'string'.`);
53+
} finally {
54+
unhookStdout();
55+
unhookStderr();
56+
}
57+
});
58+
4159
describe('custom project layout', function() {
4260
it('generates .d.ts files from the specified source tree', async () => {
4361
fs.ensureDirSync('src');

0 commit comments

Comments
 (0)