fix: multi-app project extend root tsconfig.json
(#11374)
This commit is contained in:
parent
92f586cf18
commit
1b2d920fe6
@ -111,10 +111,21 @@ function getProjectBaseUrl(project: any, port: number): string {
|
||||
}
|
||||
|
||||
function getTsConfigPath(project: AngularProject): string {
|
||||
const filename = 'tsconfig.json';
|
||||
|
||||
if (!project.root) {
|
||||
return '../tsconfig.json';
|
||||
return `../${filename}`;
|
||||
}
|
||||
return `../tsconfig.app.json`;
|
||||
|
||||
const nested = project.root
|
||||
.split('/')
|
||||
.map(() => {
|
||||
return '../';
|
||||
})
|
||||
.join('');
|
||||
|
||||
// Prepend a single `../` as we put the test inside `e2e` folder
|
||||
return `../${nested}${filename}`;
|
||||
}
|
||||
|
||||
export function addCommonFiles(
|
||||
|
@ -93,6 +93,19 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
||||
expect(tree.files).toContain('/e2e/tests/app.test.ts');
|
||||
expect(options['testRunner']).toBe('node');
|
||||
});
|
||||
it('should create TypeScript files', async () => {
|
||||
const tree = await buildTestingTree('ng-add', 'single');
|
||||
const tsConfigPath = '/e2e/tsconfig.json';
|
||||
const tsConfig = tree.readJson(tsConfigPath);
|
||||
|
||||
expect(tree.files).toContain(tsConfigPath);
|
||||
expect(tsConfig).toMatchObject({
|
||||
extends: '../tsconfig.json',
|
||||
compilerOptions: {
|
||||
module: 'CommonJS',
|
||||
},
|
||||
});
|
||||
});
|
||||
it('should not create port value', async () => {
|
||||
const tree = await buildTestingTree('ng-add');
|
||||
|
||||
@ -193,6 +206,19 @@ describe('@puppeteer/ng-schematics: ng-add', () => {
|
||||
);
|
||||
expect(options['testRunner']).toBe('node');
|
||||
});
|
||||
it('should create TypeScript files', async () => {
|
||||
const tree = await buildTestingTree('ng-add', 'multi');
|
||||
const tsConfigPath = getMultiApplicationFile('e2e/tsconfig.json');
|
||||
const tsConfig = tree.readJson(tsConfigPath);
|
||||
|
||||
expect(tree.files).toContain(tsConfigPath);
|
||||
expect(tsConfig).toMatchObject({
|
||||
extends: '../../../tsconfig.json',
|
||||
compilerOptions: {
|
||||
module: 'CommonJS',
|
||||
},
|
||||
});
|
||||
});
|
||||
it('should not create port value', async () => {
|
||||
const tree = await buildTestingTree('ng-add');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user