Skip to content

Commit

Permalink
fix(@angular/cli): fix test typings
Browse files Browse the repository at this point in the history
Blocked by angular#5500 (fix is included in this PR so that CI will run).

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.

Related to TypeStrong/ts-node#283
Fix angular#5332
Fix angular#5351
  • Loading branch information
filipesilva committed Mar 19, 2017
1 parent dbaa04f commit 31ece40
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
Expand Up @@ -8,7 +8,8 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2016"
"es2016",
"dom"
],<% } %>
"outDir": "<%= relativeRootPath %>/out-tsc/spec",
"module": "commonjs",
Expand All @@ -17,12 +18,13 @@
"types": [
"jasmine",
"node"
]
],
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts"
"**/*.spec.ts",
"**/*.d.ts"
]
}
@@ -1,4 +1,5 @@
/* SystemJS module definition */
declare var module: {
declare var module: NodeModule;
interface NodeModule {
id: string;
};
}
1 change: 1 addition & 0 deletions packages/@angular/cli/models/webpack-test-config.ts
Expand Up @@ -28,6 +28,7 @@ export class WebpackTestConfig extends NgCliWebpackConfig {
];

this.config = webpackMerge(webpackConfigs);
delete this.config.entry;

// Remove any instance of CommonsChunkPlugin, not needed with karma-webpack.
this.config.plugins = this.config.plugins.filter((plugin: any) =>
Expand Down
3 changes: 2 additions & 1 deletion packages/@ngtools/webpack/src/extract_i18n_plugin.ts
Expand Up @@ -46,7 +46,8 @@ export class ExtractI18nPlugin implements Tapable {
if (!options.hasOwnProperty('tsConfigPath')) {
throw new Error('Must specify "tsConfigPath" in the configuration of @ngtools/webpack.');
}
this._tsConfigPath = options.tsConfigPath;
// TS represents paths internally with '/' and expects the tsconfig path to be in this format
this._tsConfigPath = options.tsConfigPath.replace(/\\/g, '/');

// Check the base path.
const maybeBasePath = path.resolve(process.cwd(), this._tsConfigPath);
Expand Down
3 changes: 2 additions & 1 deletion packages/@ngtools/webpack/src/plugin.ts
Expand Up @@ -96,7 +96,8 @@ export class AotPlugin implements Tapable {
if (!options.hasOwnProperty('tsConfigPath')) {
throw new Error('Must specify "tsConfigPath" in the configuration of @ngtools/webpack.');
}
this._tsConfigPath = options.tsConfigPath;
// TS represents paths internally with '/' and expects the tsconfig path to be in this format
this._tsConfigPath = options.tsConfigPath.replace(/\\/g, '/');

// Check the base path.
const maybeBasePath = path.resolve(process.cwd(), this._tsConfigPath);
Expand Down

0 comments on commit 31ece40

Please sign in to comment.