Skip to content

Commit 4f05519

Browse files
committed
fix(@angular/cli): fix test typings
Blocked by angular#5500 Our unit test webpack config was erroneously sending in entry points to karma-webpack, who should receive no entry points. This in turn was hiding errors related to typeRoots lookups. It was also causing unit tests compilation to behave weirdly: unit test errors would not stop compilation, because other entries would still compile. This might also have contributed to the overall slowness of unit tests in angular#5423. Fix angular#5332 Fix angular#5351
1 parent dbaa04f commit 4f05519

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.app.json

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"lib": [
1212
"es2016",
1313
"dom"
14+
],
15+
"typeRoots": [
16+
"../node_modules/@types"
1417
],<% } %>
1518
"outDir": "<%= relativeRootPath %>/out-tsc/app",
1619
"module": "es2015",

packages/@angular/cli/blueprints/ng/files/__path__/tsconfig.spec.json

+4-7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"experimentalDecorators": true,
1010
"lib": [
1111
"es2016"
12+
],
13+
"typeRoots": [
14+
"../node_modules/@types"
1215
],<% } %>
1316
"outDir": "<%= relativeRootPath %>/out-tsc/spec",
1417
"module": "commonjs",
@@ -18,11 +21,5 @@
1821
"jasmine",
1922
"node"
2023
]
21-
},
22-
"files": [
23-
"test.ts"
24-
],
25-
"include": [
26-
"**/*.spec.ts"
27-
]
24+
}
2825
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* SystemJS module definition */
2-
declare var module: {
2+
declare var module: NodeModule;
3+
interface NodeModule {
34
id: string;
4-
};
5+
}

packages/@angular/cli/blueprints/ng/files/e2e/tsconfig.e2e.json

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"experimentalDecorators": true,
1010
"lib": [
1111
"es2016"
12+
],
13+
"typeRoots": [
14+
"../node_modules/@types"
1215
],<% } %>
1316
"outDir": "../out-tsc/e2e",
1417
"module": "commonjs",

packages/@angular/cli/models/webpack-test-config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class WebpackTestConfig extends NgCliWebpackConfig {
2828
];
2929

3030
this.config = webpackMerge(webpackConfigs);
31+
delete this.config.entry;
3132

3233
// Remove any instance of CommonsChunkPlugin, not needed with karma-webpack.
3334
this.config.plugins = this.config.plugins.filter((plugin: any) =>

0 commit comments

Comments
 (0)