test(ivy): fix `ngtools_api` test under ivy (#28542)

PR Close #28542
This commit is contained in:
George Kalpakas 2019-02-07 19:02:57 +02:00 committed by Miško Hevery
parent e6c51b3e06
commit 3eec314ba9
1 changed files with 6 additions and 4 deletions

View File

@ -7,7 +7,7 @@
*/
import {__NGTOOLS_PRIVATE_API_2 as NgTools_InternalApi_NG_2} from '@angular/compiler-cli';
import {fixmeIvy} from '@angular/private/testing';
import {fixmeIvy, ivyEnabled} from '@angular/private/testing';
import * as path from 'path';
import * as ts from 'typescript';
@ -19,7 +19,7 @@ describe('ngtools_api (deprecated)', () => {
beforeEach(() => { testSupport = setup(); });
function createProgram(rootNames: string[]) {
const options = testSupport.createCompilerOptions();
const options = testSupport.createCompilerOptions({enableIvy: ivyEnabled && 'ngtsc'});
const host = ts.createCompilerHost(options, true);
const program =
ts.createProgram(rootNames.map(p => path.resolve(testSupport.basePath, p)), options, host);
@ -62,7 +62,8 @@ describe('ngtools_api (deprecated)', () => {
fixmeIvy('FW-629: ngtsc lists lazy routes').it('should list lazy routes recursively', () => {
writeSomeRoutes();
const {program, host, options} = createProgram(['src/main.ts']);
const {program, host, options} =
createProgram(['src/main.ts', 'src/child.ts', 'src/child2.ts']);
const routes = NgTools_InternalApi_NG_2.listLazyRoutes({
program,
host,
@ -77,7 +78,8 @@ describe('ngtools_api (deprecated)', () => {
it('should allow to emit the program after analyzing routes', () => {
writeSomeRoutes();
const {program, host, options} = createProgram(['src/main.ts']);
const {program, host, options} =
createProgram(['src/main.ts', 'src/child.ts', 'src/child2.ts']);
NgTools_InternalApi_NG_2.listLazyRoutes({
program,
host,