Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/next/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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: [],
};
}
);
}