parent
e6c51b3e06
commit
3eec314ba9
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {__NGTOOLS_PRIVATE_API_2 as NgTools_InternalApi_NG_2} from '@angular/compiler-cli';
|
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 path from 'path';
|
||||||
import * as ts from 'typescript';
|
import * as ts from 'typescript';
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ describe('ngtools_api (deprecated)', () => {
|
||||||
beforeEach(() => { testSupport = setup(); });
|
beforeEach(() => { testSupport = setup(); });
|
||||||
|
|
||||||
function createProgram(rootNames: string[]) {
|
function createProgram(rootNames: string[]) {
|
||||||
const options = testSupport.createCompilerOptions();
|
const options = testSupport.createCompilerOptions({enableIvy: ivyEnabled && 'ngtsc'});
|
||||||
const host = ts.createCompilerHost(options, true);
|
const host = ts.createCompilerHost(options, true);
|
||||||
const program =
|
const program =
|
||||||
ts.createProgram(rootNames.map(p => path.resolve(testSupport.basePath, p)), options, host);
|
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', () => {
|
fixmeIvy('FW-629: ngtsc lists lazy routes').it('should list lazy routes recursively', () => {
|
||||||
writeSomeRoutes();
|
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({
|
const routes = NgTools_InternalApi_NG_2.listLazyRoutes({
|
||||||
program,
|
program,
|
||||||
host,
|
host,
|
||||||
|
@ -77,7 +78,8 @@ describe('ngtools_api (deprecated)', () => {
|
||||||
|
|
||||||
it('should allow to emit the program after analyzing routes', () => {
|
it('should allow to emit the program after analyzing routes', () => {
|
||||||
writeSomeRoutes();
|
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({
|
NgTools_InternalApi_NG_2.listLazyRoutes({
|
||||||
program,
|
program,
|
||||||
host,
|
host,
|
||||||
|
|
Loading…
Reference in New Issue