feat(angular): remove protractor (#15627)

This commit is contained in:
Colum Ferry 2023-03-16 16:38:04 +00:00 committed by GitHub
parent 942f984231
commit 7812f41994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 35 additions and 274 deletions

View File

@ -15,12 +15,12 @@
"githubRoot": "https://github.com/nrwl/nx/blob/master", "githubRoot": "https://github.com/nrwl/nx/blob/master",
"name": "angular", "name": "angular",
"packageName": "@nrwl/angular", "packageName": "@nrwl/angular",
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Cypress, and Protractor. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.", "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
"documents": { "documents": {
"/packages/angular/documents/overview": { "/packages/angular/documents/overview": {
"id": "overview", "id": "overview",
"name": "Overview", "name": "Overview",
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Cypress, and Protractor. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.", "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
"file": "generated/packages/angular/documents/overview", "file": "generated/packages/angular/documents/overview",
"itemList": [], "itemList": [],
"isExternal": false, "isExternal": false,
@ -31,7 +31,7 @@
"/packages/angular/documents/angular-nx-version-matrix": { "/packages/angular/documents/angular-nx-version-matrix": {
"id": "angular-nx-version-matrix", "id": "angular-nx-version-matrix",
"name": "Angular and Nx Version Matrix", "name": "Angular and Nx Version Matrix",
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Cypress, and Protractor. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.", "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
"file": "generated/packages/angular/documents/angular-nx-version-matrix", "file": "generated/packages/angular/documents/angular-nx-version-matrix",
"itemList": [], "itemList": [],
"isExternal": false, "isExternal": false,

View File

@ -11,12 +11,12 @@
"source": "/packages/add-nx-to-monorepo/src" "source": "/packages/add-nx-to-monorepo/src"
}, },
{ {
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Cypress, and Protractor. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.", "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
"documents": [ "documents": [
{ {
"id": "overview", "id": "overview",
"name": "Overview", "name": "Overview",
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Cypress, and Protractor. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.", "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
"file": "generated/packages/angular/documents/overview", "file": "generated/packages/angular/documents/overview",
"itemList": [], "itemList": [],
"isExternal": false, "isExternal": false,
@ -27,7 +27,7 @@
{ {
"id": "angular-nx-version-matrix", "id": "angular-nx-version-matrix",
"name": "Angular and Nx Version Matrix", "name": "Angular and Nx Version Matrix",
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Cypress, and Protractor. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.", "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
"file": "generated/packages/angular/documents/angular-nx-version-matrix", "file": "generated/packages/angular/documents/angular-nx-version-matrix",
"itemList": [], "itemList": [],
"isExternal": false, "isExternal": false,

View File

@ -1,6 +1,7 @@
The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries
within an Nx workspace. It provides:
- Integration with libraries such as Storybook, Jest, Cypress, Karma, and Protractor. - Integration with libraries such as Storybook, Jest and Cypress.
- Generators to help scaffold code quickly, including: - Generators to help scaffold code quickly, including:
- Micro Frontends - Micro Frontends
- Libraries, both internal to your codebase and publishable to npm - Libraries, both internal to your codebase and publishable to npm
@ -10,7 +11,8 @@ The Nx Plugin for Angular contains executors, generators, and utilities for mana
- Utilities for automatic workspace refactoring. - Utilities for automatic workspace refactoring.
{% callout type="note" title="Currently using the Angular CLI?" %} {% callout type="note" title="Currently using the Angular CLI?" %}
You can easily and mostly **automatically migrate from an Angular CLI** project to Nx! Learn more [here](/recipes/adopting-nx/migration-angular). You can easily and mostly **automatically migrate from an Angular CLI** project to Nx! Learn
more [here](/recipes/adopting-nx/migration-angular).
{% /callout %} {% /callout %}
## Setting up the Angular plugin ## Setting up the Angular plugin
@ -79,7 +81,9 @@ Read more about:
### Fallback to `@schematics/angular` ### Fallback to `@schematics/angular`
If you try to invoke a generator that is not present in `@nrwl/angular`, the request will automatically be forwarded on to `@schematics/angular`. So, even though there is no `@nrwl/angular:service` generator, the following command will successfully create a service: If you try to invoke a generator that is not present in `@nrwl/angular`, the request will automatically be forwarded on
to `@schematics/angular`. So, even though there is no `@nrwl/angular:service` generator, the following command will
successfully create a service:
```shell ```shell
nx g @nrwl/angular:service my-service nx g @nrwl/angular:service my-service

View File

@ -102,8 +102,8 @@
}, },
"e2eTestRunner": { "e2eTestRunner": {
"type": "string", "type": "string",
"enum": ["protractor", "cypress", "none"], "enum": ["cypress", "none"],
"description": "Test runner to use for end to end (E2E) tests. The `protractor` option is deprecated and it will be removed in v15.", "description": "Test runner to use for end to end (E2E) tests.",
"default": "cypress" "default": "cypress"
}, },
"tags": { "tags": {

View File

@ -109,7 +109,7 @@
}, },
"e2eTestRunner": { "e2eTestRunner": {
"type": "string", "type": "string",
"enum": ["protractor", "cypress", "none"], "enum": ["cypress", "none"],
"description": "Test runner to use for end to end (E2E) tests.", "description": "Test runner to use for end to end (E2E) tests.",
"default": "cypress" "default": "cypress"
}, },

View File

@ -24,7 +24,7 @@
}, },
"e2eTestRunner": { "e2eTestRunner": {
"type": "string", "type": "string",
"enum": ["protractor", "cypress", "none"], "enum": ["cypress", "none"],
"description": "Test runner to use for end to end (e2e) tests.", "description": "Test runner to use for end to end (e2e) tests.",
"default": "cypress", "default": "cypress",
"x-priority": "important" "x-priority": "important"

View File

@ -103,7 +103,7 @@
}, },
"e2eTestRunner": { "e2eTestRunner": {
"type": "string", "type": "string",
"enum": ["protractor", "cypress", "none"], "enum": ["cypress", "none"],
"description": "Test runner to use for end to end (E2E) tests.", "description": "Test runner to use for end to end (E2E) tests.",
"default": "cypress" "default": "cypress"
}, },

View File

@ -1,6 +1,7 @@
The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries
within an Nx workspace. It provides:
- Integration with libraries such as Storybook, Jest, Cypress, Karma, and Protractor. - Integration with libraries such as Storybook, Jest and Cypress.
- Generators to help scaffold code quickly, including: - Generators to help scaffold code quickly, including:
- Micro Frontends - Micro Frontends
- Libraries, both internal to your codebase and publishable to npm - Libraries, both internal to your codebase and publishable to npm
@ -10,7 +11,8 @@ The Nx Plugin for Angular contains executors, generators, and utilities for mana
- Utilities for automatic workspace refactoring. - Utilities for automatic workspace refactoring.
{% callout type="note" title="Currently using the Angular CLI?" %} {% callout type="note" title="Currently using the Angular CLI?" %}
You can easily and mostly **automatically migrate from an Angular CLI** project to Nx! Learn more [here](/recipes/adopting-nx/migration-angular). You can easily and mostly **automatically migrate from an Angular CLI** project to Nx! Learn
more [here](/recipes/adopting-nx/migration-angular).
{% /callout %} {% /callout %}
## Setting up the Angular plugin ## Setting up the Angular plugin
@ -79,7 +81,9 @@ Read more about:
### Fallback to `@schematics/angular` ### Fallback to `@schematics/angular`
If you try to invoke a generator that is not present in `@nrwl/angular`, the request will automatically be forwarded on to `@schematics/angular`. So, even though there is no `@nrwl/angular:service` generator, the following command will successfully create a service: If you try to invoke a generator that is not present in `@nrwl/angular`, the request will automatically be forwarded on
to `@schematics/angular`. So, even though there is no `@nrwl/angular:service` generator, the following command will
successfully create a service:
```shell ```shell
nx g @nrwl/angular:service my-service nx g @nrwl/angular:service my-service

View File

@ -209,7 +209,6 @@
"prettier": "^2.6.2", "prettier": "^2.6.2",
"prettier-plugin-tailwindcss": "^0.1.5", "prettier-plugin-tailwindcss": "^0.1.5",
"pretty-quick": "^3.1.0", "pretty-quick": "^3.1.0",
"protractor": "5.4.3",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
"react-redux": "8.0.5", "react-redux": "8.0.5",
"react-refresh": "^0.10.0", "react-refresh": "^0.10.0",

View File

@ -2,7 +2,7 @@
"name": "@nrwl/angular", "name": "@nrwl/angular",
"version": "0.0.1", "version": "0.0.1",
"private": false, "private": false,
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Cypress, and Protractor. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.", "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/nrwl/nx.git", "url": "https://github.com/nrwl/nx.git",

View File

@ -1,22 +1,11 @@
import type { Tree } from '@nrwl/devkit'; import type { Tree } from '@nrwl/devkit';
import { getWorkspaceLayout, joinPathFragments } from '@nrwl/devkit';
import type { NormalizedSchema } from './normalized-schema'; import type { NormalizedSchema } from './normalized-schema';
import { cypressProjectGenerator } from '@nrwl/cypress'; import { cypressProjectGenerator } from '@nrwl/cypress';
import { E2eTestRunner } from '../../../../utils/test-runners';
import { addProtractor } from './add-protractor';
import { removeScaffoldedE2e } from './remove-scaffolded-e2e'; import { removeScaffoldedE2e } from './remove-scaffolded-e2e';
import { updateE2eProject } from './update-e2e-project';
import { Linter, lintProjectGenerator } from '@nrwl/linter';
export async function addE2e(tree: Tree, options: NormalizedSchema) { export async function addE2e(tree: Tree, options: NormalizedSchema) {
if (options.e2eTestRunner === E2eTestRunner.Protractor) { removeScaffoldedE2e(tree, options, options.ngCliSchematicE2ERoot);
await addProtractor(tree, options);
} else {
removeScaffoldedE2e(tree, options, options.ngCliSchematicE2ERoot);
}
if (options.e2eTestRunner === 'cypress') { if (options.e2eTestRunner === 'cypress') {
await cypressProjectGenerator(tree, { await cypressProjectGenerator(tree, {
@ -30,21 +19,4 @@ export async function addE2e(tree: Tree, options: NormalizedSchema) {
rootProject: options.rootProject, rootProject: options.rootProject,
}); });
} }
if (options.e2eTestRunner === E2eTestRunner.Protractor) {
updateE2eProject(tree, options);
if (options.linter === Linter.EsLint) {
await lintProjectGenerator(tree, {
project: options.e2eProjectName,
linter: options.linter,
eslintFilePatterns: [
joinPathFragments(options.e2eProjectRoot, '**/*.ts'),
],
unitTestRunner: options.unitTestRunner,
skipFormat: true,
setParserOptionsProject: options.setParserOptionsProject,
skipPackageJson: options.skipPackageJson,
});
}
}
} }

View File

@ -1,22 +0,0 @@
import type { Tree } from '@nrwl/devkit';
import { joinPathFragments, moveFilesToNewDirectory } from '@nrwl/devkit';
import type { NormalizedSchema } from './normalized-schema';
export async function addProtractor(host: Tree, options: NormalizedSchema) {
const { wrapAngularDevkitSchematic } = require('@nrwl/devkit/ngcli-adapter');
const protractorSchematic = wrapAngularDevkitSchematic(
'@schematics/angular',
'e2e'
);
await protractorSchematic(host, {
relatedAppName: options.name,
rootSelector: `${options.prefix}-root`,
});
moveFilesToNewDirectory(
host,
joinPathFragments(options.appProjectRoot, 'e2e'),
options.e2eProjectRoot
);
}

View File

@ -1,6 +1,5 @@
export * from './add-e2e'; export * from './add-e2e';
export * from './add-linting'; export * from './add-linting';
export * from './add-protractor';
export * from './add-proxy-config'; export * from './add-proxy-config';
export * from './add-unit-test-runner'; export * from './add-unit-test-runner';
export * from './create-files'; export * from './create-files';

View File

@ -1,23 +1,11 @@
import type { Tree } from '@nrwl/devkit'; import type { Tree } from '@nrwl/devkit';
import { joinPathFragments } from '@nrwl/devkit';
import type { NormalizedSchema } from './normalized-schema'; import type { NormalizedSchema } from './normalized-schema';
import { cypressProjectGenerator } from '@nrwl/cypress'; import { cypressProjectGenerator } from '@nrwl/cypress';
import { E2eTestRunner } from '../../../utils/test-runners';
import { addProtractor } from './add-protractor';
import { removeScaffoldedE2e } from './remove-scaffolded-e2e'; import { removeScaffoldedE2e } from './remove-scaffolded-e2e';
import { updateE2eProject } from './update-e2e-project';
import { Linter, lintProjectGenerator } from '@nrwl/linter';
export async function addE2e(tree: Tree, options: NormalizedSchema) { export async function addE2e(tree: Tree, options: NormalizedSchema) {
if (options.e2eTestRunner === E2eTestRunner.Protractor) { removeScaffoldedE2e(tree, options, options.ngCliSchematicE2ERoot);
await addProtractor(tree, options);
} else {
removeScaffoldedE2e(tree, options, options.ngCliSchematicE2ERoot);
}
if (options.e2eTestRunner === 'cypress') { if (options.e2eTestRunner === 'cypress') {
await cypressProjectGenerator(tree, { await cypressProjectGenerator(tree, {
name: options.e2eProjectName, name: options.e2eProjectName,
@ -30,21 +18,4 @@ export async function addE2e(tree: Tree, options: NormalizedSchema) {
rootProject: options.rootProject, rootProject: options.rootProject,
}); });
} }
if (options.e2eTestRunner === E2eTestRunner.Protractor) {
updateE2eProject(tree, options);
if (options.linter === Linter.EsLint) {
await lintProjectGenerator(tree, {
project: options.e2eProjectName,
linter: options.linter,
eslintFilePatterns: [
joinPathFragments(options.e2eProjectRoot, '**/*.ts'),
],
unitTestRunner: options.unitTestRunner,
skipFormat: true,
setParserOptionsProject: options.setParserOptionsProject,
skipPackageJson: options.skipPackageJson,
});
}
}
} }

View File

@ -1,22 +0,0 @@
import type { Tree } from '@nrwl/devkit';
import { joinPathFragments, moveFilesToNewDirectory } from '@nrwl/devkit';
import type { NormalizedSchema } from './normalized-schema';
export async function addProtractor(host: Tree, options: NormalizedSchema) {
const { wrapAngularDevkitSchematic } = require('@nrwl/devkit/ngcli-adapter');
const protractorSchematic = wrapAngularDevkitSchematic(
'@schematics/angular',
'e2e'
);
await protractorSchematic(host, {
relatedAppName: options.name,
rootSelector: `${options.prefix}-root`,
});
moveFilesToNewDirectory(
host,
joinPathFragments(options.appProjectRoot, 'e2e'),
options.e2eProjectRoot
);
}

View File

@ -1,6 +1,5 @@
export * from './add-e2e'; export * from './add-e2e';
export * from './add-linting'; export * from './add-linting';
export * from './add-protractor';
export * from './add-proxy-config'; export * from './add-proxy-config';
export * from './add-unit-test-runner'; export * from './add-unit-test-runner';
export * from './create-files'; export * from './create-files';

View File

@ -105,8 +105,8 @@
}, },
"e2eTestRunner": { "e2eTestRunner": {
"type": "string", "type": "string",
"enum": ["protractor", "cypress", "none"], "enum": ["cypress", "none"],
"description": "Test runner to use for end to end (E2E) tests. The `protractor` option is deprecated and it will be removed in v15.", "description": "Test runner to use for end to end (E2E) tests.",
"default": "cypress" "default": "cypress"
}, },
"tags": { "tags": {

View File

@ -112,7 +112,7 @@
}, },
"e2eTestRunner": { "e2eTestRunner": {
"type": "string", "type": "string",
"enum": ["protractor", "cypress", "none"], "enum": ["cypress", "none"],
"description": "Test runner to use for end to end (E2E) tests.", "description": "Test runner to use for end to end (E2E) tests.",
"default": "cypress" "default": "cypress"
}, },

View File

@ -183,27 +183,6 @@ async function addE2ETestRunner(
options: Schema options: Schema
): Promise<GeneratorCallback> { ): Promise<GeneratorCallback> {
switch (options.e2eTestRunner) { switch (options.e2eTestRunner) {
case E2eTestRunner.Protractor:
return !options.skipPackageJson
? addDependenciesToPackageJsonIfDontExist(
tree,
{},
{
protractor:
backwardCompatibleVersions.angularV14.protractorVersion,
'jasmine-core':
backwardCompatibleVersions.angularV14.jasmineCoreVersion,
'jasmine-spec-reporter':
backwardCompatibleVersions.angularV14
.jasmineSpecReporterVersion,
'ts-node': backwardCompatibleVersions.angularV14.tsNodeVersion,
'@types/jasmine':
backwardCompatibleVersions.angularV14.typesJasmineVersion,
'@types/jasminewd2':
backwardCompatibleVersions.angularV14.typesJasminewd2Version,
}
)
: () => {};
case E2eTestRunner.Cypress: case E2eTestRunner.Cypress:
return await cypressInitGenerator(tree, { return await cypressInitGenerator(tree, {
skipPackageJson: options.skipPackageJson, skipPackageJson: options.skipPackageJson,

View File

@ -198,44 +198,6 @@ describe('init', () => {
); );
}); });
}); });
describe('protractor', () => {
it('should add protractor dependencies', async () => {
// ACT
await init(tree, {
unitTestRunner: UnitTestRunner.None,
e2eTestRunner: E2eTestRunner.Protractor,
linter: Linter.EsLint,
skipFormat: false,
});
const { devDependencies } = readJson(tree, 'package.json');
// ASSERT
expect(devDependencies['protractor']).toBeDefined();
expect(devDependencies['jasmine-core']).toBeDefined();
expect(devDependencies['jasmine-spec-reporter']).toBeDefined();
expect(devDependencies['@types/jasmine']).toBeDefined();
expect(devDependencies['@types/jasminewd2']).toBeDefined();
});
it('should set defaults', async () => {
// ACT
await init(tree, {
unitTestRunner: UnitTestRunner.None,
e2eTestRunner: E2eTestRunner.Protractor,
linter: Linter.EsLint,
skipFormat: false,
});
const { generators } = readJson<NxJsonConfiguration>(tree, 'nx.json');
// ASSERT
expect(generators['@nrwl/angular:application'].e2eTestRunner).toEqual(
'protractor'
);
});
});
}); });
describe('--linter', () => { describe('--linter', () => {
@ -528,54 +490,6 @@ bar
); );
}); });
}); });
describe('protractor', () => {
it('should add protractor dependencies', async () => {
// ACT
await init(tree, {
unitTestRunner: UnitTestRunner.None,
e2eTestRunner: E2eTestRunner.Protractor,
linter: Linter.EsLint,
skipFormat: false,
});
const { devDependencies } = readJson(tree, 'package.json');
// ASSERT
expect(devDependencies['protractor']).toEqual(
backwardCompatibleVersions.angularV14.protractorVersion
);
expect(devDependencies['jasmine-core']).toEqual(
backwardCompatibleVersions.angularV14.jasmineCoreVersion
);
expect(devDependencies['jasmine-spec-reporter']).toEqual(
backwardCompatibleVersions.angularV14.jasmineSpecReporterVersion
);
expect(devDependencies['@types/jasmine']).toEqual(
backwardCompatibleVersions.angularV14.typesJasmineVersion
);
expect(devDependencies['@types/jasminewd2']).toEqual(
backwardCompatibleVersions.angularV14.typesJasminewd2Version
);
});
it('should set defaults', async () => {
// ACT
await init(tree, {
unitTestRunner: UnitTestRunner.None,
e2eTestRunner: E2eTestRunner.Protractor,
linter: Linter.EsLint,
skipFormat: false,
});
const { generators } = readJson<NxJsonConfiguration>(tree, 'nx.json');
// ASSERT
expect(generators['@nrwl/angular:application'].e2eTestRunner).toEqual(
'protractor'
);
});
});
}); });
describe('--linter', () => { describe('--linter', () => {

View File

@ -19,15 +19,9 @@ import { E2eTestRunner, UnitTestRunner } from '../../utils/test-runners';
import { import {
angularDevkitVersion, angularDevkitVersion,
angularVersion, angularVersion,
jasmineCoreVersion,
jasmineSpecReporterVersion,
jestPresetAngularVersion, jestPresetAngularVersion,
protractorVersion,
rxjsVersion, rxjsVersion,
tsLibVersion, tsLibVersion,
tsNodeVersion,
typesJasmineVersion,
typesJasminewd2Version,
zoneJsVersion, zoneJsVersion,
} from '../../utils/versions'; } from '../../utils/versions';
import { import {
@ -205,21 +199,6 @@ async function addE2ETestRunner(
options: Schema options: Schema
): Promise<GeneratorCallback> { ): Promise<GeneratorCallback> {
switch (options.e2eTestRunner) { switch (options.e2eTestRunner) {
case E2eTestRunner.Protractor:
return !options.skipPackageJson
? addDependenciesToPackageJsonIfDontExist(
tree,
{},
{
protractor: protractorVersion,
'jasmine-core': jasmineCoreVersion,
'jasmine-spec-reporter': jasmineSpecReporterVersion,
'ts-node': tsNodeVersion,
'@types/jasmine': typesJasmineVersion,
'@types/jasminewd2': typesJasminewd2Version,
}
)
: () => {};
case E2eTestRunner.Cypress: case E2eTestRunner.Cypress:
return cypressInitGenerator(tree, { return cypressInitGenerator(tree, {
skipPackageJson: options.skipPackageJson, skipPackageJson: options.skipPackageJson,

View File

@ -21,7 +21,7 @@
}, },
"e2eTestRunner": { "e2eTestRunner": {
"type": "string", "type": "string",
"enum": ["protractor", "cypress", "none"], "enum": ["cypress", "none"],
"description": "Test runner to use for end to end (e2e) tests.", "description": "Test runner to use for end to end (e2e) tests.",
"default": "cypress", "default": "cypress",
"x-priority": "important" "x-priority": "important"

View File

@ -106,7 +106,7 @@
}, },
"e2eTestRunner": { "e2eTestRunner": {
"type": "string", "type": "string",
"enum": ["protractor", "cypress", "none"], "enum": ["cypress", "none"],
"description": "Test runner to use for end to end (E2E) tests.", "description": "Test runner to use for end to end (E2E) tests.",
"default": "cypress" "default": "cypress"
}, },

View File

@ -35,11 +35,6 @@ export const backwardCompatibleVersions: Record<
autoprefixerVersion: '^10.4.0', autoprefixerVersion: '^10.4.0',
tsNodeVersion: '10.9.1', tsNodeVersion: '10.9.1',
jestPresetAngularVersion: '~12.2.3', jestPresetAngularVersion: '~12.2.3',
protractorVersion: '~7.0.0',
jasmineCoreVersion: '~4.2.0',
jasmineSpecReporterVersion: '~7.0.0',
typesJasmineVersion: '~4.0.0',
typesJasminewd2Version: '~2.0.3',
typesNodeVersion: '16.11.7', typesNodeVersion: '16.11.7',
jasmineMarblesVersion: '^0.9.2', jasmineMarblesVersion: '^0.9.2',
}, },

View File

@ -4,11 +4,6 @@ export enum UnitTestRunner {
} }
export enum E2eTestRunner { export enum E2eTestRunner {
/**
* @deprecated Protractor is no longer maintained. Support for generating
* E2E tests with it will be removed in v15.
*/
Protractor = 'protractor',
Cypress = 'cypress', Cypress = 'cypress',
None = 'none', None = 'none',
} }

View File

@ -26,10 +26,5 @@ export const autoprefixerVersion = '^10.4.0';
export const tsNodeVersion = '10.9.1'; export const tsNodeVersion = '10.9.1';
export const jestPresetAngularVersion = '~13.0.0'; export const jestPresetAngularVersion = '~13.0.0';
export const protractorVersion = '~7.0.0';
export const jasmineCoreVersion = '~4.2.0';
export const jasmineSpecReporterVersion = '~7.0.0';
export const typesJasmineVersion = '~4.0.0';
export const typesJasminewd2Version = '~2.0.3';
export const typesNodeVersion = '16.11.7'; export const typesNodeVersion = '16.11.7';
export const jasmineMarblesVersion = '^0.9.2'; export const jasmineMarblesVersion = '^0.9.2';