diff --git a/e2e/node.test.ts b/e2e/node.test.ts index 2be47b55a13e6..b79d48726c270 100644 --- a/e2e/node.test.ts +++ b/e2e/node.test.ts @@ -160,6 +160,7 @@ forEachCli(currentCLIName => { ); // respects "extends" inside tsconfigs expect(config.options.emitDecoratorMetadata).toEqual(true); // required by nest to function properly + expect(config.options.target).toEqual(ts.ScriptTarget.ES2015); // required by nest swagger to function properly cleanup(); }, 120000); diff --git a/packages/nest/src/schematics/application/application.spec.ts b/packages/nest/src/schematics/application/application.spec.ts index fe169a3c8bf92..2a61bcdd13c32 100644 --- a/packages/nest/src/schematics/application/application.spec.ts +++ b/packages/nest/src/schematics/application/application.spec.ts @@ -1,6 +1,7 @@ import { Tree } from '@angular-devkit/schematics'; import { createEmptyWorkspace } from '@nrwl/workspace/testing'; import { runSchematic } from '../../utils/testing'; +import { readJsonInTree } from '@nrwl/workspace'; describe('app', () => { let appTree: Tree; @@ -17,4 +18,10 @@ describe('app', () => { ); expect(tree.exists('apps/my-node-app/src/app/app.module.ts')).toBeTruthy(); }); + + it('should have es2015 as the tsconfig target', async () => { + const tree = await runSchematic('app', { name: 'myNodeApp' }, appTree); + const tsconfig = readJsonInTree(tree, 'apps/my-node-app/tsconfig.json'); + expect(tsconfig.compilerOptions.target).toBe('es2015'); + }); }); diff --git a/packages/nest/src/schematics/application/application.ts b/packages/nest/src/schematics/application/application.ts index 9fe2035bda284..e77b34b5d63d3 100644 --- a/packages/nest/src/schematics/application/application.ts +++ b/packages/nest/src/schematics/application/application.ts @@ -73,6 +73,7 @@ export default function(schema: Schema): Rule { addAppFiles(options), updateJsonInTree(join(options.appProjectRoot, 'tsconfig.json'), json => { json.compilerOptions.emitDecoratorMetadata = true; + json.compilerOptions.target = 'es2015'; return json; }), formatFiles(options)