Skip to content

Commit

Permalink
fix(schematics): exclude jest setup file in tsconfig.app.json
Browse files Browse the repository at this point in the history
  • Loading branch information
skydever authored and vsavkin committed Oct 4, 2018
1 parent 9714a97 commit 4bd39e7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/schematics/src/collection/application/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
});
});

Expand Down
5 changes: 4 additions & 1 deletion packages/schematics/src/collection/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand All @@ -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']
};
}),
Expand Down

0 comments on commit 4bd39e7

Please sign in to comment.