Skip to content

Commit 26ef974

Browse files
committed
fix(@angular/cli): ng test should include test.ts and spec files
1 parent 97368d8 commit 26ef974

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/@angular/cli/models/webpack-configs/typescript.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ export function getAotConfig(wco: WebpackConfigOptions) {
134134
// Fallback to exclude spec files from AoT compilation on projects using a shared tsconfig.
135135
if (testTsConfigPath === tsConfigPath) {
136136
let exclude = [ '**/*.spec.ts' ];
137-
if (appConfig.test) { exclude.push(path.join(projectRoot, appConfig.root, appConfig.test)); }
137+
if (appConfig.test) {
138+
exclude.push(path.join(projectRoot, appConfig.root, appConfig.test));
139+
}
138140
pluginOptions.exclude = exclude;
139141
}
140142

@@ -164,7 +166,10 @@ export function getNonAotTestConfig(wco: WebpackConfigOptions) {
164166
// Force include main and polyfills.
165167
// This is needed for AngularCompilerPlugin compatibility with existing projects,
166168
// since TS compilation there is stricter and tsconfig.spec.ts doesn't include them.
167-
const include = [appConfig.main, appConfig.polyfills];
169+
const include = [appConfig.main, appConfig.polyfills, '**/*.spec.ts'];
170+
if (appConfig.test) {
171+
include.push(appConfig.test);
172+
}
168173

169174
let pluginOptions: any = { tsConfigPath, skipCodeGeneration: true, include };
170175

0 commit comments

Comments
 (0)