fix(nextjs): Add exclude to root projects e2e tsconfig so that tests will be picked up. (#16459)

This commit is contained in:
Nicholas Cunningham 2023-04-21 09:52:52 -06:00 committed by GitHub
parent 258cda37ec
commit a908ef586a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import { nextInitGenerator } from '../init/init';
import { addStyleDependencies } from '../../utils/styles';
import { addLinting } from './lib/add-linting';
import { customServerGenerator } from '../custom-server/custom-server';
import { updateCypressTsConfig } from './lib/update-cypress-tsconfig';
export async function applicationGenerator(host: Tree, schema: Schema) {
const options = normalizeOptions(host, schema);
@ -31,6 +32,7 @@ export async function applicationGenerator(host: Tree, schema: Schema) {
const jestTask = await addJest(host, options);
const lintTask = await addLinting(host, options);
updateJestConfig(host, options);
updateCypressTsConfig(host, options);
const styledTask = addStyleDependencies(host, options.style);
setDefaults(host, options);

View File

@ -0,0 +1,19 @@
import { Tree, updateJson } from '@nx/devkit';
import { NormalizedSchema } from './normalize-options';
export function updateCypressTsConfig(host: Tree, options: NormalizedSchema) {
if (options.e2eTestRunner !== 'cypress' || !options.rootProject) {
return;
}
updateJson(
host,
`${options.e2eProjectRoot}/${options.e2eProjectName}/tsconfig.json`,
(json) => {
return {
...json,
exclude: [],
};
}
);
}