From 62d5d43dd88e9d220b87cf0ba4fabf335846c9c5 Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 9 Nov 2021 11:15:34 -0600 Subject: [PATCH] docs(testing): document adding Cypress E2E app for an existing project (#7669) --- docs/shared/cypress-plugin.md | 20 ++++- .../api-angular/executors/webpack-browser.md | 18 ++-- .../api-angular/executors/webpack-server.md | 84 ------------------- .../latest/angular/api-jest/executors/jest.md | 6 ++ .../api-workspace/generators/library.md | 2 +- .../api-angular/executors/webpack-browser.md | 18 ++-- .../api-angular/executors/webpack-server.md | 84 ------------------- .../node/api-angular/generators/library.md | 8 -- .../latest/node/api-jest/executors/jest.md | 6 ++ .../node/api-workspace/generators/library.md | 2 +- .../api-angular/executors/webpack-browser.md | 18 ++-- .../api-angular/executors/webpack-server.md | 84 ------------------- .../latest/react/api-jest/executors/jest.md | 6 ++ .../react/api-workspace/generators/library.md | 2 +- .../latest/shared/cypress-plugin.md | 20 ++++- 15 files changed, 77 insertions(+), 301 deletions(-) diff --git a/docs/shared/cypress-plugin.md b/docs/shared/cypress-plugin.md index e6edd44d1a..4b0aec0ca6 100644 --- a/docs/shared/cypress-plugin.md +++ b/docs/shared/cypress-plugin.md @@ -49,6 +49,24 @@ nx g @nrwl/web:app frontend └── tsconfig.base.json ``` +### Creating a Cypress E2E project for an existing project + +You can create a new Cypress E2E project for an existing project. + +If the `@nrwl/cypress` package is not installed, install the version that matches your `@nrwl/workspace` version. + +```sh +npm install --save-dev @nrwl/cypress +``` + +Next, generate an E2E project based on an existing project. + +```sh +nx g @nrwl/cypress:cypress-project your-app-name-e2e --project=your-app-name +``` + +Replace `your-app-name` with the app's name as defined in your `workspace.json` file. + ### Testing Applications Simply run `nx e2e frontend-e2e` to execute e2e tests with Cypress. @@ -59,7 +77,7 @@ Screenshots and videos will be accessible in `dist/apps/frontend/screenshots` an ### Watching for Changes -With, `ng e2e frontend-e2e --watch` Cypress will start in the application mode. +With, `nx e2e frontend-e2e --watch` Cypress will start in the application mode. Running Cypress with `--watch` is a great way to enhance dev workflow - you can build up test files with the application running and Cypress will re-run those tests as you enhance and add to the suite. diff --git a/nx-dev/nx-dev/public/documentation/latest/angular/api-angular/executors/webpack-browser.md b/nx-dev/nx-dev/public/documentation/latest/angular/api-angular/executors/webpack-browser.md index b241b7b904..5b8b290ed4 100644 --- a/nx-dev/nx-dev/public/documentation/latest/angular/api-angular/executors/webpack-browser.md +++ b/nx-dev/nx-dev/public/documentation/latest/angular/api-angular/executors/webpack-browser.md @@ -22,7 +22,9 @@ The full path for the main entry point to the app, relative to the current works Type: `string` -The full path for the new output directory, relative to the current workspace. By default, writes output to a folder named dist/ in the current project. + The full path for the new output directory, relative to the current workspace. + +By default, writes output to a folder named dist/ in the current project. ### tsConfig (_**required**_) @@ -96,22 +98,14 @@ Type: `boolean` Delete the output path before building. -### deployUrl +### ~~deployUrl~~ Type: `string` +**Deprecated:** Use "baseHref" option, "APP_BASE_HREF" DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url. + URL where files will be deployed. -### ~~extractCss~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** Deprecated since version 11.0. No longer required to disable CSS extraction for HMR. - -Extract CSS from global styles into '.css' files instead of '.js'. - ### extractLicenses Default: `true` diff --git a/nx-dev/nx-dev/public/documentation/latest/angular/api-angular/executors/webpack-server.md b/nx-dev/nx-dev/public/documentation/latest/angular/api-angular/executors/webpack-server.md index e6a8c5fd60..5dee430914 100644 --- a/nx-dev/nx-dev/public/documentation/latest/angular/api-angular/executors/webpack-server.md +++ b/nx-dev/nx-dev/public/documentation/latest/angular/api-angular/executors/webpack-server.md @@ -18,38 +18,6 @@ Type: `array` List of hosts that are allowed to access the dev server. -### ~~aot~~ - -Type: `boolean` - -**Deprecated:** Use the "aot" option in the browser builder instead. - -Build using Ahead of Time compilation. - -### ~~baseHref~~ - -Type: `string` - -**Deprecated:** Use the "baseHref" option in the browser builder instead. - -Base url for the application being built. - -### ~~commonChunk~~ - -Type: `boolean` - -**Deprecated:** Use the "commonChunk" option in the browser builder instead. - -Generate a seperate bundle containing code used across multiple bundles. - -### ~~deployUrl~~ - -Type: `string` - -**Deprecated:** Use the "deployUrl" option in the browser builder instead. - -URL where files will be deployed. - ### disableHostCheck Default: `false` @@ -66,16 +34,6 @@ Type: `boolean` Enable hot module replacement. -### ~~hmrWarning~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** No longer has an effect. - -Show a warning when the --hmr option is enabled. - ### host Default: `localhost` @@ -102,14 +60,6 @@ Type: `boolean` Opens the url in default browser. -### ~~optimization~~ - -Type: `boolean` - -**Deprecated:** Use the "optimization" option in the browser builder instead. - -Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration. - ### poll Type: `number` @@ -124,14 +74,6 @@ Type: `number` Port to listen on. -### ~~progress~~ - -Type: `boolean` - -**Deprecated:** Use the "progress" option in the browser builder instead. - -Log progress to the console while building. - ### proxyConfig Type: `string` @@ -150,24 +92,6 @@ Type: `string` The pathname where the app will be served. -### ~~servePathDefaultWarning~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** No longer has an effect. - -Show a warning when deploy-url/base-href use unsupported serve path values. - -### ~~sourceMap~~ - -Type: `boolean` - -**Deprecated:** Use the "sourceMap" option in the browser builder instead. - -Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration. - ### ssl Default: `false` @@ -188,14 +112,6 @@ Type: `string` SSL key to use for serving HTTPS. -### ~~vendorChunk~~ - -Type: `boolean` - -**Deprecated:** Use the "vendorChunk" option in the browser builder instead. - -Generate a seperate bundle containing only vendor libraries. This option should only used for development. - ### verbose Type: `boolean` diff --git a/nx-dev/nx-dev/public/documentation/latest/angular/api-jest/executors/jest.md b/nx-dev/nx-dev/public/documentation/latest/angular/api-jest/executors/jest.md index a2c7bf6f74..f64cf0fd34 100644 --- a/nx-dev/nx-dev/public/documentation/latest/angular/api-jest/executors/jest.md +++ b/nx-dev/nx-dev/public/documentation/latest/angular/api-jest/executors/jest.md @@ -176,6 +176,12 @@ Type: `string` Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/cli#--testnamepatternregex) +### testPathIgnorePatterns + +Type: `array` + +An array of regexp pattern strings that is matched against all tests paths before executing the test. Only run those tests with a path that does not match with the provided regexp expressions. (https://jestjs.io/docs/cli#--testpathignorepatternsregexarray) + ### testPathPattern Type: `array` diff --git a/nx-dev/nx-dev/public/documentation/latest/angular/api-workspace/generators/library.md b/nx-dev/nx-dev/public/documentation/latest/angular/api-workspace/generators/library.md index c932034ad6..a7a65f468d 100644 --- a/nx-dev/nx-dev/public/documentation/latest/angular/api-workspace/generators/library.md +++ b/nx-dev/nx-dev/public/documentation/latest/angular/api-workspace/generators/library.md @@ -84,7 +84,7 @@ Default: `eslint` Type: `string` -Possible values: `eslint`, `tslint` +Possible values: `eslint` The tool to use for running lint checks. diff --git a/nx-dev/nx-dev/public/documentation/latest/node/api-angular/executors/webpack-browser.md b/nx-dev/nx-dev/public/documentation/latest/node/api-angular/executors/webpack-browser.md index 5b96915b8a..0ca1627dfc 100644 --- a/nx-dev/nx-dev/public/documentation/latest/node/api-angular/executors/webpack-browser.md +++ b/nx-dev/nx-dev/public/documentation/latest/node/api-angular/executors/webpack-browser.md @@ -22,7 +22,9 @@ The full path for the main entry point to the app, relative to the current works Type: `string` -The full path for the new output directory, relative to the current workspace. By default, writes output to a folder named dist/ in the current project. + The full path for the new output directory, relative to the current workspace. + +By default, writes output to a folder named dist/ in the current project. ### tsConfig (_**required**_) @@ -96,22 +98,14 @@ Type: `boolean` Delete the output path before building. -### deployUrl +### ~~deployUrl~~ Type: `string` +**Deprecated:** Use "baseHref" option, "APP_BASE_HREF" DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url. + URL where files will be deployed. -### ~~extractCss~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** Deprecated since version 11.0. No longer required to disable CSS extraction for HMR. - -Extract CSS from global styles into '.css' files instead of '.js'. - ### extractLicenses Default: `true` diff --git a/nx-dev/nx-dev/public/documentation/latest/node/api-angular/executors/webpack-server.md b/nx-dev/nx-dev/public/documentation/latest/node/api-angular/executors/webpack-server.md index 4841579caa..2e25c624e7 100644 --- a/nx-dev/nx-dev/public/documentation/latest/node/api-angular/executors/webpack-server.md +++ b/nx-dev/nx-dev/public/documentation/latest/node/api-angular/executors/webpack-server.md @@ -18,38 +18,6 @@ Type: `array` List of hosts that are allowed to access the dev server. -### ~~aot~~ - -Type: `boolean` - -**Deprecated:** Use the "aot" option in the browser builder instead. - -Build using Ahead of Time compilation. - -### ~~baseHref~~ - -Type: `string` - -**Deprecated:** Use the "baseHref" option in the browser builder instead. - -Base url for the application being built. - -### ~~commonChunk~~ - -Type: `boolean` - -**Deprecated:** Use the "commonChunk" option in the browser builder instead. - -Generate a seperate bundle containing code used across multiple bundles. - -### ~~deployUrl~~ - -Type: `string` - -**Deprecated:** Use the "deployUrl" option in the browser builder instead. - -URL where files will be deployed. - ### disableHostCheck Default: `false` @@ -66,16 +34,6 @@ Type: `boolean` Enable hot module replacement. -### ~~hmrWarning~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** No longer has an effect. - -Show a warning when the --hmr option is enabled. - ### host Default: `localhost` @@ -102,14 +60,6 @@ Type: `boolean` Opens the url in default browser. -### ~~optimization~~ - -Type: `boolean` - -**Deprecated:** Use the "optimization" option in the browser builder instead. - -Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration. - ### poll Type: `number` @@ -124,14 +74,6 @@ Type: `number` Port to listen on. -### ~~progress~~ - -Type: `boolean` - -**Deprecated:** Use the "progress" option in the browser builder instead. - -Log progress to the console while building. - ### proxyConfig Type: `string` @@ -150,24 +92,6 @@ Type: `string` The pathname where the app will be served. -### ~~servePathDefaultWarning~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** No longer has an effect. - -Show a warning when deploy-url/base-href use unsupported serve path values. - -### ~~sourceMap~~ - -Type: `boolean` - -**Deprecated:** Use the "sourceMap" option in the browser builder instead. - -Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration. - ### ssl Default: `false` @@ -188,14 +112,6 @@ Type: `string` SSL key to use for serving HTTPS. -### ~~vendorChunk~~ - -Type: `boolean` - -**Deprecated:** Use the "vendorChunk" option in the browser builder instead. - -Generate a seperate bundle containing only vendor libraries. This option should only used for development. - ### verbose Type: `boolean` diff --git a/nx-dev/nx-dev/public/documentation/latest/node/api-angular/generators/library.md b/nx-dev/nx-dev/public/documentation/latest/node/api-angular/generators/library.md index 8b132c3a4a..9d79e86a6b 100644 --- a/nx-dev/nx-dev/public/documentation/latest/node/api-angular/generators/library.md +++ b/nx-dev/nx-dev/public/documentation/latest/node/api-angular/generators/library.md @@ -50,14 +50,6 @@ Type: `string` A directory where the library is placed. -### enableIvy - -Default: `false` - -Type: `boolean` - -Enable Ivy for library in `tsconfig.lib.prod.json`. Should not be used with publishable libraries. - ### importPath Type: `string` diff --git a/nx-dev/nx-dev/public/documentation/latest/node/api-jest/executors/jest.md b/nx-dev/nx-dev/public/documentation/latest/node/api-jest/executors/jest.md index 6347a70cf7..011f3e1179 100644 --- a/nx-dev/nx-dev/public/documentation/latest/node/api-jest/executors/jest.md +++ b/nx-dev/nx-dev/public/documentation/latest/node/api-jest/executors/jest.md @@ -176,6 +176,12 @@ Type: `string` Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/cli#--testnamepatternregex) +### testPathIgnorePatterns + +Type: `array` + +An array of regexp pattern strings that is matched against all tests paths before executing the test. Only run those tests with a path that does not match with the provided regexp expressions. (https://jestjs.io/docs/cli#--testpathignorepatternsregexarray) + ### testPathPattern Type: `array` diff --git a/nx-dev/nx-dev/public/documentation/latest/node/api-workspace/generators/library.md b/nx-dev/nx-dev/public/documentation/latest/node/api-workspace/generators/library.md index ac8bc44510..6830e9675f 100644 --- a/nx-dev/nx-dev/public/documentation/latest/node/api-workspace/generators/library.md +++ b/nx-dev/nx-dev/public/documentation/latest/node/api-workspace/generators/library.md @@ -84,7 +84,7 @@ Default: `eslint` Type: `string` -Possible values: `eslint`, `tslint` +Possible values: `eslint` The tool to use for running lint checks. diff --git a/nx-dev/nx-dev/public/documentation/latest/react/api-angular/executors/webpack-browser.md b/nx-dev/nx-dev/public/documentation/latest/react/api-angular/executors/webpack-browser.md index 5b96915b8a..0ca1627dfc 100644 --- a/nx-dev/nx-dev/public/documentation/latest/react/api-angular/executors/webpack-browser.md +++ b/nx-dev/nx-dev/public/documentation/latest/react/api-angular/executors/webpack-browser.md @@ -22,7 +22,9 @@ The full path for the main entry point to the app, relative to the current works Type: `string` -The full path for the new output directory, relative to the current workspace. By default, writes output to a folder named dist/ in the current project. + The full path for the new output directory, relative to the current workspace. + +By default, writes output to a folder named dist/ in the current project. ### tsConfig (_**required**_) @@ -96,22 +98,14 @@ Type: `boolean` Delete the output path before building. -### deployUrl +### ~~deployUrl~~ Type: `string` +**Deprecated:** Use "baseHref" option, "APP_BASE_HREF" DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url. + URL where files will be deployed. -### ~~extractCss~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** Deprecated since version 11.0. No longer required to disable CSS extraction for HMR. - -Extract CSS from global styles into '.css' files instead of '.js'. - ### extractLicenses Default: `true` diff --git a/nx-dev/nx-dev/public/documentation/latest/react/api-angular/executors/webpack-server.md b/nx-dev/nx-dev/public/documentation/latest/react/api-angular/executors/webpack-server.md index 4841579caa..2e25c624e7 100644 --- a/nx-dev/nx-dev/public/documentation/latest/react/api-angular/executors/webpack-server.md +++ b/nx-dev/nx-dev/public/documentation/latest/react/api-angular/executors/webpack-server.md @@ -18,38 +18,6 @@ Type: `array` List of hosts that are allowed to access the dev server. -### ~~aot~~ - -Type: `boolean` - -**Deprecated:** Use the "aot" option in the browser builder instead. - -Build using Ahead of Time compilation. - -### ~~baseHref~~ - -Type: `string` - -**Deprecated:** Use the "baseHref" option in the browser builder instead. - -Base url for the application being built. - -### ~~commonChunk~~ - -Type: `boolean` - -**Deprecated:** Use the "commonChunk" option in the browser builder instead. - -Generate a seperate bundle containing code used across multiple bundles. - -### ~~deployUrl~~ - -Type: `string` - -**Deprecated:** Use the "deployUrl" option in the browser builder instead. - -URL where files will be deployed. - ### disableHostCheck Default: `false` @@ -66,16 +34,6 @@ Type: `boolean` Enable hot module replacement. -### ~~hmrWarning~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** No longer has an effect. - -Show a warning when the --hmr option is enabled. - ### host Default: `localhost` @@ -102,14 +60,6 @@ Type: `boolean` Opens the url in default browser. -### ~~optimization~~ - -Type: `boolean` - -**Deprecated:** Use the "optimization" option in the browser builder instead. - -Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, tree-shaking and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration. - ### poll Type: `number` @@ -124,14 +74,6 @@ Type: `number` Port to listen on. -### ~~progress~~ - -Type: `boolean` - -**Deprecated:** Use the "progress" option in the browser builder instead. - -Log progress to the console while building. - ### proxyConfig Type: `string` @@ -150,24 +92,6 @@ Type: `string` The pathname where the app will be served. -### ~~servePathDefaultWarning~~ - -Default: `true` - -Type: `boolean` - -**Deprecated:** No longer has an effect. - -Show a warning when deploy-url/base-href use unsupported serve path values. - -### ~~sourceMap~~ - -Type: `boolean` - -**Deprecated:** Use the "sourceMap" option in the browser builder instead. - -Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration. - ### ssl Default: `false` @@ -188,14 +112,6 @@ Type: `string` SSL key to use for serving HTTPS. -### ~~vendorChunk~~ - -Type: `boolean` - -**Deprecated:** Use the "vendorChunk" option in the browser builder instead. - -Generate a seperate bundle containing only vendor libraries. This option should only used for development. - ### verbose Type: `boolean` diff --git a/nx-dev/nx-dev/public/documentation/latest/react/api-jest/executors/jest.md b/nx-dev/nx-dev/public/documentation/latest/react/api-jest/executors/jest.md index 6347a70cf7..011f3e1179 100644 --- a/nx-dev/nx-dev/public/documentation/latest/react/api-jest/executors/jest.md +++ b/nx-dev/nx-dev/public/documentation/latest/react/api-jest/executors/jest.md @@ -176,6 +176,12 @@ Type: `string` Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/cli#--testnamepatternregex) +### testPathIgnorePatterns + +Type: `array` + +An array of regexp pattern strings that is matched against all tests paths before executing the test. Only run those tests with a path that does not match with the provided regexp expressions. (https://jestjs.io/docs/cli#--testpathignorepatternsregexarray) + ### testPathPattern Type: `array` diff --git a/nx-dev/nx-dev/public/documentation/latest/react/api-workspace/generators/library.md b/nx-dev/nx-dev/public/documentation/latest/react/api-workspace/generators/library.md index ac8bc44510..6830e9675f 100644 --- a/nx-dev/nx-dev/public/documentation/latest/react/api-workspace/generators/library.md +++ b/nx-dev/nx-dev/public/documentation/latest/react/api-workspace/generators/library.md @@ -84,7 +84,7 @@ Default: `eslint` Type: `string` -Possible values: `eslint`, `tslint` +Possible values: `eslint` The tool to use for running lint checks. diff --git a/nx-dev/nx-dev/public/documentation/latest/shared/cypress-plugin.md b/nx-dev/nx-dev/public/documentation/latest/shared/cypress-plugin.md index e6edd44d1a..4b0aec0ca6 100644 --- a/nx-dev/nx-dev/public/documentation/latest/shared/cypress-plugin.md +++ b/nx-dev/nx-dev/public/documentation/latest/shared/cypress-plugin.md @@ -49,6 +49,24 @@ nx g @nrwl/web:app frontend └── tsconfig.base.json ``` +### Creating a Cypress E2E project for an existing project + +You can create a new Cypress E2E project for an existing project. + +If the `@nrwl/cypress` package is not installed, install the version that matches your `@nrwl/workspace` version. + +```sh +npm install --save-dev @nrwl/cypress +``` + +Next, generate an E2E project based on an existing project. + +```sh +nx g @nrwl/cypress:cypress-project your-app-name-e2e --project=your-app-name +``` + +Replace `your-app-name` with the app's name as defined in your `workspace.json` file. + ### Testing Applications Simply run `nx e2e frontend-e2e` to execute e2e tests with Cypress. @@ -59,7 +77,7 @@ Screenshots and videos will be accessible in `dist/apps/frontend/screenshots` an ### Watching for Changes -With, `ng e2e frontend-e2e --watch` Cypress will start in the application mode. +With, `nx e2e frontend-e2e --watch` Cypress will start in the application mode. Running Cypress with `--watch` is a great way to enhance dev workflow - you can build up test files with the application running and Cypress will re-run those tests as you enhance and add to the suite.