Skip to content

Commit

Permalink
fix(angular): do not configure e2e test runner when generating a libr…
Browse files Browse the repository at this point in the history
…ary (#10553)
  • Loading branch information
leosvelperez committed Jun 2, 2022
1 parent aecca6b commit ec90625
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 3 additions & 1 deletion e2e/angular-core/src/ng-add.test.ts
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
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
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

0 comments on commit ec90625

Please sign in to comment.