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(angular): do not configure e2e test runner when generating a library #10553

Merged
merged 1 commit into from
Jun 2, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion e2e/angular-core/src/ng-add.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
}

function addCypress() {
runNgAdd('@cypress/schematic', '--e2e-update', 'latest');
// TODO(leo): @cypress/schematic latest comes with Cypress 10 support
// which we don't support yet in our Cypress plugin.
runNgAdd('@cypress/schematic', '--e2e-update', '1.7.0');
}

function addEsLint() {
Expand Down
15 changes: 15 additions & 0 deletions packages/angular/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,21 @@ describe('lib', () => {
].prefix
).toEqual('custom');
});

it('should not install any e2e test runners', async () => {
// ACT
await runLibraryGeneratorWithOpts({
publishable: true,
importPath: '@myorg/lib',
});

// ASSERT
let { dependencies, devDependencies } = readJson(tree, 'package.json');
expect(dependencies.cypress).toBeUndefined();
expect(devDependencies.cypress).toBeUndefined();
expect(dependencies.protractor).toBeUndefined();
expect(devDependencies.protractor).toBeUndefined();
});
});

describe('nested', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/angular/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { jestProjectGenerator } from '@nrwl/jest';
import { Linter } from '@nrwl/linter';
import { convertToNxProjectGenerator } from '@nrwl/workspace/generators';
import init from '../../generators/init/init';
import { E2eTestRunner } from '../../utils/test-runners';
import { ngPackagrVersion } from '../../utils/versions';
import addLintingGenerator from '../add-linting/add-linting';
import karmaProjectGenerator from '../karma-project/karma-project';
Expand Down Expand Up @@ -51,6 +52,7 @@ export async function libraryGenerator(host: Tree, schema: Partial<Schema>) {
await init(host, {
...options,
skipFormat: true,
e2eTestRunner: E2eTestRunner.None,
});

const runAngularLibrarySchematic = wrapAngularDevkitSchematic(
Expand Down