fix(testing): use cypress generated tsconfig for angular ct (#12014)
This commit is contained in:
parent
7ae08c3eb7
commit
d535cf3d43
@ -146,27 +146,27 @@ import {CommonModule} from '@angular/common';
|
|||||||
|
|
||||||
it('should test app', () => {
|
it('should test app', () => {
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/angular:cypress-component-configuration --project=${appName} --generate-tests`
|
`generate @nrwl/angular:cypress-component-configuration --project=${appName} --generate-tests --no-interactive`
|
||||||
);
|
);
|
||||||
expect(runCLI(`component-test ${appName} --no-watch`)).toContain(
|
expect(runCLI(`component-test ${appName} --no-watch`)).toContain(
|
||||||
'All specs passed!'
|
'All specs passed!'
|
||||||
);
|
);
|
||||||
}, 1000000);
|
}, 300_000);
|
||||||
|
|
||||||
it('should successfully component test lib being used in app', () => {
|
it('should successfully component test lib being used in app', () => {
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/angular:cypress-component-configuration --project=${usedInAppLibName} --generate-tests`
|
`generate @nrwl/angular:cypress-component-configuration --project=${usedInAppLibName} --generate-tests --no-interactive`
|
||||||
);
|
);
|
||||||
expect(runCLI(`component-test ${usedInAppLibName} --no-watch`)).toContain(
|
expect(runCLI(`component-test ${usedInAppLibName} --no-watch`)).toContain(
|
||||||
'All specs passed!'
|
'All specs passed!'
|
||||||
);
|
);
|
||||||
}, 1000000);
|
}, 300_000);
|
||||||
|
|
||||||
it('should test buildable lib not being used in app', () => {
|
it('should test buildable lib not being used in app', () => {
|
||||||
expect(() => {
|
expect(() => {
|
||||||
// should error since no edge in graph between lib and app
|
// should error since no edge in graph between lib and app
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/angular:cypress-component-configuration --project=${buildableLibName} --generate-tests`
|
`generate @nrwl/angular:cypress-component-configuration --project=${buildableLibName} --generate-tests --no-interactive`
|
||||||
);
|
);
|
||||||
}).toThrow();
|
}).toThrow();
|
||||||
createFile(
|
createFile(
|
||||||
@ -232,7 +232,7 @@ describe(InputStandaloneComponent.name, () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
runCLI(
|
runCLI(
|
||||||
`generate @nrwl/angular:cypress-component-configuration --project=${buildableLibName} --generate-tests --build-target=${appName}:build`
|
`generate @nrwl/angular:cypress-component-configuration --project=${buildableLibName} --generate-tests --build-target=${appName}:build --no-interactive`
|
||||||
);
|
);
|
||||||
expect(runCLI(`component-test ${buildableLibName} --no-watch`)).toContain(
|
expect(runCLI(`component-test ${buildableLibName} --no-watch`)).toContain(
|
||||||
'All specs passed!'
|
'All specs passed!'
|
||||||
@ -261,5 +261,5 @@ describe(InputStandaloneComponent.name, () => {
|
|||||||
'All specs passed!'
|
'All specs passed!'
|
||||||
);
|
);
|
||||||
checkFilesDoNotExist(`tmp/libs/${buildableLibName}/ct-styles.css`);
|
checkFilesDoNotExist(`tmp/libs/${buildableLibName}/ct-styles.css`);
|
||||||
}, 1000000);
|
}, 300_000);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -172,11 +172,14 @@ function normalizeBuildTargetOptions(
|
|||||||
buildOptions.index =
|
buildOptions.index =
|
||||||
typeof buildOptions.index === 'string'
|
typeof buildOptions.index === 'string'
|
||||||
? joinPathFragments(offset, buildOptions.index)
|
? joinPathFragments(offset, buildOptions.index)
|
||||||
: (buildOptions.index.input = joinPathFragments(
|
: {
|
||||||
offset,
|
...buildOptions.index,
|
||||||
buildOptions.index.input
|
input: joinPathFragments(offset, buildOptions.index.input),
|
||||||
));
|
};
|
||||||
buildOptions.tsConfig = joinPathFragments(offset, buildOptions.tsConfig);
|
// cypress creates a tsconfig if one isn't preset
|
||||||
|
// that contains all the support required for angular and component tests
|
||||||
|
delete buildOptions.tsConfig;
|
||||||
|
|
||||||
buildOptions.fileReplacements = buildOptions.fileReplacements.map((fr) => {
|
buildOptions.fileReplacements = buildOptions.fileReplacements.map((fr) => {
|
||||||
fr.replace = joinPathFragments(offset, fr.replace);
|
fr.replace = joinPathFragments(offset, fr.replace);
|
||||||
fr.with = joinPathFragments(offset, fr.with);
|
fr.with = joinPathFragments(offset, fr.with);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user