Skip to content

Commit

Permalink
fix(nextjs): Add exclude to root projects e2e tsconfig so that tests …
Browse files Browse the repository at this point in the history
…will be picked up. (nrwl#16459)
  • Loading branch information
ndcunningham authored Apr 21, 2023
1 parent 258cda3 commit a908ef5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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: [],
};
}
);
}

0 comments on commit a908ef5

Please sign in to comment.