diff --git a/packages/schematics/angular/application/index.ts b/packages/schematics/angular/application/index.ts index 49e333f636fb..1a39e397a90b 100644 --- a/packages/schematics/angular/application/index.ts +++ b/packages/schematics/angular/application/index.ts @@ -56,7 +56,7 @@ export default function (options: ApplicationOptions): Rule { return chain([ addAppToWorkspaceFile(options, appDir, folderName), addTsProjectReference('./' + join(normalize(appDir), 'tsconfig.app.json')), - options.skipTests + options.skipTests || options.minimal ? noop() : addTsProjectReference('./' + join(normalize(appDir), 'tsconfig.spec.json')), options.standalone diff --git a/packages/schematics/angular/application/index_spec.ts b/packages/schematics/angular/application/index_spec.ts index d15db7a4a843..f1e39307e4e9 100644 --- a/packages/schematics/angular/application/index_spec.ts +++ b/packages/schematics/angular/application/index_spec.ts @@ -138,6 +138,22 @@ describe('Application Schematic', () => { ); }); + it('should not add spec project reference in the root tsconfig.json with "minimal" enabled', async () => { + const tree = await schematicRunner.runSchematic( + 'application', + { ...defaultOptions, minimal: true }, + workspaceTree, + ); + + const { references } = readJsonFile(tree, '/tsconfig.json'); + expect(references).toContain( + jasmine.objectContaining({ path: './projects/foo/tsconfig.app.json' }), + ); + expect(references).not.toContain( + jasmine.objectContaining({ path: './projects/foo/tsconfig.spec.json' }), + ); + }); + it('should install npm dependencies when `skipInstall` is false', async () => { await schematicRunner.runSchematic( 'application',