fix(schematics): exclude jest setup file in tsconfig.app.json

This commit is contained in:
skydever 2018-09-24 22:51:19 +02:00 committed by Victor Savkin
parent 9714a97f3c
commit 4bd39e7f85
2 changed files with 15 additions and 1 deletions

View File

@ -303,6 +303,17 @@ describe('app', () => {
'apps/my-app/tsconfig.app.json',
'apps/my-app/tsconfig.spec.json'
]);
const tsconfigAppJson = readJsonInTree(
tree,
'apps/my-app/tsconfig.app.json'
);
expect(tsconfigAppJson.exclude).toEqual([
'src/test-setup.ts',
'**/*.spec.ts'
]);
expect(tsconfigAppJson.compilerOptions.outDir).toEqual(
'../../dist/out-tsc/apps/my-app'
);
});
});

View File

@ -175,7 +175,6 @@ function updateProject(options: NormalizedSchema): Rule {
return json;
}),
updateJsonInTree(`${options.appProjectRoot}/tsconfig.app.json`, json => {
json.exclude = json.exclude || [];
return {
...json,
extends: `${offsetFromRoot(options.appProjectRoot)}tsconfig.json`,
@ -185,6 +184,10 @@ function updateProject(options: NormalizedSchema): Rule {
options.appProjectRoot
}`
},
exclude:
options.unitTestRunner === 'jest'
? ['src/test-setup.ts', '**/*.spec.ts']
: json.exclude || [],
include: ['**/*.ts']
};
}),