From da0705ff4705e0d1752b00e1d697c0a5af7be077 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:15:41 -0400 Subject: [PATCH 01/23] chore: release @cypress/angular-v1.1.0 [skip ci] --- npm/angular/CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/npm/angular/CHANGELOG.md b/npm/angular/CHANGELOG.md index ef48cf256fd1..ef3b3e8a8d70 100644 --- a/npm/angular/CHANGELOG.md +++ b/npm/angular/CHANGELOG.md @@ -1,3 +1,15 @@ +# [@cypress/angular-v1.1.0](https://github.com/cypress-io/cypress/compare/@cypress/angular-v1.0.0...@cypress/angular-v1.1.0) (2022-08-30) + + +### Bug Fixes + +* angular 14.2 mount compilation error ([#23593](https://github.com/cypress-io/cypress/issues/23593)) ([2f337db](https://github.com/cypress-io/cypress/commit/2f337dbfa2bb212754c8fa82e3f4548a2f3a07a4)) + + +### Features + +* adding svelte component testing support ([#23553](https://github.com/cypress-io/cypress/issues/23553)) ([f6eaad4](https://github.com/cypress-io/cypress/commit/f6eaad40e1836fa9db87c60defa5ae6f390c8fd8)) + # @cypress/angular-v1.0.0 (2022-08-17) From 75da5c7a523a920da9bc396d6e4c2fc41597adcf Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:15:52 -0400 Subject: [PATCH 02/23] chore: release @cypress/schematic-v2.1.0 [skip ci] --- npm/cypress-schematic/CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/npm/cypress-schematic/CHANGELOG.md b/npm/cypress-schematic/CHANGELOG.md index 0c9b0380c5e9..3ac2f43925be 100644 --- a/npm/cypress-schematic/CHANGELOG.md +++ b/npm/cypress-schematic/CHANGELOG.md @@ -1,3 +1,15 @@ +# [@cypress/schematic-v2.1.0](https://github.com/cypress-io/cypress/compare/@cypress/schematic-v2.0.3...@cypress/schematic-v2.1.0) (2022-08-30) + + +### Bug Fixes + +* angular 14.2 mount compilation error ([#23593](https://github.com/cypress-io/cypress/issues/23593)) ([2f337db](https://github.com/cypress-io/cypress/commit/2f337dbfa2bb212754c8fa82e3f4548a2f3a07a4)) + + +### Features + +* **cypress/schematic:** add support for component testing ([#23385](https://github.com/cypress-io/cypress/issues/23385)) ([99562af](https://github.com/cypress-io/cypress/commit/99562af65a10abb0fab211fd97b13f98e2b0f959)) + # [@cypress/schematic-v2.0.3](https://github.com/cypress-io/cypress/compare/@cypress/schematic-v2.0.2...@cypress/schematic-v2.0.3) (2022-08-17) From 962322a2beb7596d49d96ba7553746a53547199e Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:16:04 -0400 Subject: [PATCH 03/23] chore: release @cypress/mount-utils-v2.1.0 [skip ci] --- npm/mount-utils/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npm/mount-utils/CHANGELOG.md b/npm/mount-utils/CHANGELOG.md index 0a4cb0126439..4dab067c7bb4 100644 --- a/npm/mount-utils/CHANGELOG.md +++ b/npm/mount-utils/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/mount-utils-v2.1.0](https://github.com/cypress-io/cypress/compare/@cypress/mount-utils-v2.0.1...@cypress/mount-utils-v2.1.0) (2022-08-30) + + +### Features + +* adding svelte component testing support ([#23553](https://github.com/cypress-io/cypress/issues/23553)) ([f6eaad4](https://github.com/cypress-io/cypress/commit/f6eaad40e1836fa9db87c60defa5ae6f390c8fd8)) + # [@cypress/mount-utils-v2.0.1](https://github.com/cypress-io/cypress/compare/@cypress/mount-utils-v2.0.0...@cypress/mount-utils-v2.0.1) (2022-08-11) From e5812538933e3c5d5c2a262f287080d47d4619e7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:16:16 -0400 Subject: [PATCH 04/23] chore: release @cypress/react-v6.2.0 [skip ci] --- npm/react/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npm/react/CHANGELOG.md b/npm/react/CHANGELOG.md index ccd4da3d2172..c5457e9baeb4 100644 --- a/npm/react/CHANGELOG.md +++ b/npm/react/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/react-v6.2.0](https://github.com/cypress-io/cypress/compare/@cypress/react-v6.1.1...@cypress/react-v6.2.0) (2022-08-30) + + +### Features + +* adding svelte component testing support ([#23553](https://github.com/cypress-io/cypress/issues/23553)) ([f6eaad4](https://github.com/cypress-io/cypress/commit/f6eaad40e1836fa9db87c60defa5ae6f390c8fd8)) + # [@cypress/react-v6.1.1](https://github.com/cypress-io/cypress/compare/@cypress/react-v6.1.0...@cypress/react-v6.1.1) (2022-08-15) From 8bfcf38f25bd0514b41bd2ee109e9fe8cca17ed8 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:16:27 -0400 Subject: [PATCH 05/23] chore: release @cypress/react18-v1.1.0 [skip ci] --- npm/react18/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npm/react18/CHANGELOG.md b/npm/react18/CHANGELOG.md index 8cfa4bfbe84a..6d8f201ace66 100644 --- a/npm/react18/CHANGELOG.md +++ b/npm/react18/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/react18-v1.1.0](https://github.com/cypress-io/cypress/compare/@cypress/react18-v1.0.1...@cypress/react18-v1.1.0) (2022-08-30) + + +### Features + +* adding svelte component testing support ([#23553](https://github.com/cypress-io/cypress/issues/23553)) ([f6eaad4](https://github.com/cypress-io/cypress/commit/f6eaad40e1836fa9db87c60defa5ae6f390c8fd8)) + # [@cypress/react18-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/react18-v1.0.0...@cypress/react18-v1.0.1) (2022-08-15) From 03a79d37f624fcaf795ae731e59d80ef03d0101b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:25:42 -0400 Subject: [PATCH 06/23] chore: release @cypress/svelte-v1.0.0 [skip ci] --- npm/svelte/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/npm/svelte/CHANGELOG.md b/npm/svelte/CHANGELOG.md index e69de29bb2d1..786b6f134519 100644 --- a/npm/svelte/CHANGELOG.md +++ b/npm/svelte/CHANGELOG.md @@ -0,0 +1,6 @@ +# @cypress/svelte-v1.0.0 (2022-08-30) + + +### Features + +* adding svelte component testing support ([#23553](https://github.com/cypress-io/cypress/issues/23553)) ([f6eaad4](https://github.com/cypress-io/cypress/commit/f6eaad40e1836fa9db87c60defa5ae6f390c8fd8)) From c55b0c22a4b93784fb3a06fdb75747b2135b8c35 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:26:08 -0400 Subject: [PATCH 07/23] chore: release @cypress/vue-v4.2.0 [skip ci] --- npm/vue/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npm/vue/CHANGELOG.md b/npm/vue/CHANGELOG.md index ab6354332477..cc935df6d8bb 100644 --- a/npm/vue/CHANGELOG.md +++ b/npm/vue/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/vue-v4.2.0](https://github.com/cypress-io/cypress/compare/@cypress/vue-v4.1.0...@cypress/vue-v4.2.0) (2022-08-30) + + +### Features + +* adding svelte component testing support ([#23553](https://github.com/cypress-io/cypress/issues/23553)) ([f6eaad4](https://github.com/cypress-io/cypress/commit/f6eaad40e1836fa9db87c60defa5ae6f390c8fd8)) + # [@cypress/vue-v4.1.0](https://github.com/cypress-io/cypress/compare/@cypress/vue-v4.0.0...@cypress/vue-v4.1.0) (2022-08-11) From d519375de49e96d4364b3588ab3be6cc7ece50c7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:26:25 -0400 Subject: [PATCH 08/23] chore: release @cypress/vue2-v1.1.0 [skip ci] --- npm/vue2/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npm/vue2/CHANGELOG.md b/npm/vue2/CHANGELOG.md index d17e35662acc..f764d925a73a 100644 --- a/npm/vue2/CHANGELOG.md +++ b/npm/vue2/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/vue2-v1.1.0](https://github.com/cypress-io/cypress/compare/@cypress/vue2-v1.0.2...@cypress/vue2-v1.1.0) (2022-08-30) + + +### Features + +* adding svelte component testing support ([#23553](https://github.com/cypress-io/cypress/issues/23553)) ([f6eaad4](https://github.com/cypress-io/cypress/commit/f6eaad40e1836fa9db87c60defa5ae6f390c8fd8)) + # [@cypress/vue2-v1.0.2](https://github.com/cypress-io/cypress/compare/@cypress/vue2-v1.0.1...@cypress/vue2-v1.0.2) (2022-08-11) From 66e3d7c3e5a676f8c1289e6c8e29bae86ff59ce4 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 30 Aug 2022 15:26:41 -0400 Subject: [PATCH 09/23] chore: release @cypress/webpack-dev-server-v2.3.0 [skip ci] --- npm/webpack-dev-server/CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/npm/webpack-dev-server/CHANGELOG.md b/npm/webpack-dev-server/CHANGELOG.md index c092057c7a63..09a1a0ae6bb2 100644 --- a/npm/webpack-dev-server/CHANGELOG.md +++ b/npm/webpack-dev-server/CHANGELOG.md @@ -1,3 +1,15 @@ +# [@cypress/webpack-dev-server-v2.3.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v2.2.0...@cypress/webpack-dev-server-v2.3.0) (2022-08-30) + + +### Bug Fixes + +* **webpack-dev-server:** add custom project config to handler ([a07a2a1](https://github.com/cypress-io/cypress/commit/a07a2a118d7b62b90e790ef475c86959ae894b3b)) + + +### Features + +* adding svelte component testing support ([#23553](https://github.com/cypress-io/cypress/issues/23553)) ([f6eaad4](https://github.com/cypress-io/cypress/commit/f6eaad40e1836fa9db87c60defa5ae6f390c8fd8)) + # [@cypress/webpack-dev-server-v2.2.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v2.1.0...@cypress/webpack-dev-server-v2.2.0) (2022-08-15) From 3fd56bc1f21224150569434e94b64e781b22008d Mon Sep 17 00:00:00 2001 From: Zachary Williams Date: Wed, 31 Aug 2022 12:30:17 -0500 Subject: [PATCH 10/23] fix(cypress-schematic): suffix template files so they are not ignored (#23645) --- npm/cypress-schematic/.npmignore | 5 ----- .../cypress/e2e/{spec.cy.ts => spec.cy.ts.template} | 0 .../cypress/fixtures/{example.json => example.json.template} | 0 .../cypress/support/{commands.ts => commands.ts.template} | 0 .../files-core/cypress/support/{e2e.ts => e2e.ts.template} | 0 .../cypress/{tsconfig.json => tsconfig.json.template} | 0 .../{component-index.html => component-index.html.template} | 0 .../ng-add/files-ct/{component.ts => component.ts.template} | 0 8 files changed, 5 deletions(-) rename npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/e2e/{spec.cy.ts => spec.cy.ts.template} (100%) rename npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/fixtures/{example.json => example.json.template} (100%) rename npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/{commands.ts => commands.ts.template} (100%) rename npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/{e2e.ts => e2e.ts.template} (100%) rename npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/{tsconfig.json => tsconfig.json.template} (100%) rename npm/cypress-schematic/src/schematics/ng-add/files-ct/{component-index.html => component-index.html.template} (100%) rename npm/cypress-schematic/src/schematics/ng-add/files-ct/{component.ts => component.ts.template} (100%) diff --git a/npm/cypress-schematic/.npmignore b/npm/cypress-schematic/.npmignore index 4a9942427a0f..9efef34cdb9f 100644 --- a/npm/cypress-schematic/.npmignore +++ b/npm/cypress-schematic/.npmignore @@ -1,9 +1,4 @@ # Ignores TypeScript files, but keeps definitions. *.ts !*.d.ts - *.js.map -!src/**/__files__/**/*.js -!src/**/files/**/*.ts -*.vscode -sandbox \ No newline at end of file diff --git a/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/e2e/spec.cy.ts b/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/e2e/spec.cy.ts.template similarity index 100% rename from npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/e2e/spec.cy.ts rename to npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/e2e/spec.cy.ts.template diff --git a/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/fixtures/example.json b/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/fixtures/example.json.template similarity index 100% rename from npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/fixtures/example.json rename to npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/fixtures/example.json.template diff --git a/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/commands.ts b/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/commands.ts.template similarity index 100% rename from npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/commands.ts rename to npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/commands.ts.template diff --git a/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/e2e.ts b/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/e2e.ts.template similarity index 100% rename from npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/e2e.ts rename to npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/support/e2e.ts.template diff --git a/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/tsconfig.json b/npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/tsconfig.json.template similarity index 100% rename from npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/tsconfig.json rename to npm/cypress-schematic/src/schematics/ng-add/files-core/cypress/tsconfig.json.template diff --git a/npm/cypress-schematic/src/schematics/ng-add/files-ct/component-index.html b/npm/cypress-schematic/src/schematics/ng-add/files-ct/component-index.html.template similarity index 100% rename from npm/cypress-schematic/src/schematics/ng-add/files-ct/component-index.html rename to npm/cypress-schematic/src/schematics/ng-add/files-ct/component-index.html.template diff --git a/npm/cypress-schematic/src/schematics/ng-add/files-ct/component.ts b/npm/cypress-schematic/src/schematics/ng-add/files-ct/component.ts.template similarity index 100% rename from npm/cypress-schematic/src/schematics/ng-add/files-ct/component.ts rename to npm/cypress-schematic/src/schematics/ng-add/files-ct/component.ts.template From 2ce07924a3552cdc603508098eafeef5be361365 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 31 Aug 2022 16:32:11 -0400 Subject: [PATCH 11/23] chore: release @cypress/schematic-v2.1.1 [skip ci] --- npm/cypress-schematic/CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/npm/cypress-schematic/CHANGELOG.md b/npm/cypress-schematic/CHANGELOG.md index 3ac2f43925be..aa22d736a249 100644 --- a/npm/cypress-schematic/CHANGELOG.md +++ b/npm/cypress-schematic/CHANGELOG.md @@ -1,3 +1,10 @@ +# [@cypress/schematic-v2.1.1](https://github.com/cypress-io/cypress/compare/@cypress/schematic-v2.1.0...@cypress/schematic-v2.1.1) (2022-08-31) + + +### Bug Fixes + +* **cypress-schematic:** suffix template files so they are not ignored ([#23645](https://github.com/cypress-io/cypress/issues/23645)) ([3fd56bc](https://github.com/cypress-io/cypress/commit/3fd56bc1f21224150569434e94b64e781b22008d)) + # [@cypress/schematic-v2.1.0](https://github.com/cypress-io/cypress/compare/@cypress/schematic-v2.0.3...@cypress/schematic-v2.1.0) (2022-08-30) From f1a079404bd06bb31059fef4615e18b7477a65bc Mon Sep 17 00:00:00 2001 From: Ronnie Laugen Date: Tue, 13 Sep 2022 04:15:10 +0200 Subject: [PATCH 12/23] fix: Use tsconfig from build if exists (closes #23673) (#23696) Falls back to tsconfig.json if one is not passed in --- .../src/helpers/angularHandler.ts | 2 +- .../test/handlers/angularHandler.spec.ts | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/npm/webpack-dev-server/src/helpers/angularHandler.ts b/npm/webpack-dev-server/src/helpers/angularHandler.ts index 0ef004aba0ca..0daa2d355d7f 100644 --- a/npm/webpack-dev-server/src/helpers/angularHandler.ts +++ b/npm/webpack-dev-server/src/helpers/angularHandler.ts @@ -133,7 +133,7 @@ export async function generateTsConfig (devServerConfig: AngularWebpackDevServer includePaths.push(cypressTypes) const tsConfigContent = JSON.stringify({ - extends: getProjectFilePath('tsconfig.json'), + extends: getProjectFilePath(buildOptions.tsConfig ?? 'tsconfig.json'), compilerOptions: { outDir: getProjectFilePath('out-tsc/cy'), allowSyntheticDefaultImports: true, diff --git a/npm/webpack-dev-server/test/handlers/angularHandler.spec.ts b/npm/webpack-dev-server/test/handlers/angularHandler.spec.ts index 02ef0a9fef58..6aac320eb345 100644 --- a/npm/webpack-dev-server/test/handlers/angularHandler.spec.ts +++ b/npm/webpack-dev-server/test/handlers/angularHandler.spec.ts @@ -195,7 +195,8 @@ const expectGeneratesTsConfig = async (devServerConfig: AngularWebpackDevServerC let tsConfig = JSON.parse(await fs.readFile(tsConfigPath, 'utf8')) expect(tsConfig).to.deep.eq({ - extends: toPosix(path.join(projectRoot, 'tsconfig.json')), + // verifies the default `tsconfig.app.json` is extended + extends: toPosix(path.join(projectRoot, 'tsconfig.app.json')), compilerOptions: { outDir: toPosix(path.join(projectRoot, 'out-tsc/cy')), allowSyntheticDefaultImports: true, @@ -211,6 +212,7 @@ const expectGeneratesTsConfig = async (devServerConfig: AngularWebpackDevServerC const modifiedBuildOptions = cloneDeep(buildOptions) delete modifiedBuildOptions.polyfills + modifiedBuildOptions.tsConfig = 'tsconfig.cy.json' const modifiedDevServerConfig = cloneDeep(devServerConfig) const supportFile = path.join(projectRoot, 'cypress', 'support', 'component.ts') @@ -220,9 +222,18 @@ const expectGeneratesTsConfig = async (devServerConfig: AngularWebpackDevServerC tsConfigPath = await generateTsConfig(modifiedDevServerConfig, modifiedBuildOptions) tsConfig = JSON.parse(await fs.readFile(tsConfigPath, 'utf8')) - expect(tsConfig.include).to.deep.equal([ - toPosix(path.join(projectRoot, 'src/**/*.cy.ts')), - toPosix(supportFile), - toPosix(path.join(projectRoot, 'node_modules/cypress/types/index.d.ts')), - ]) + expect(tsConfig).to.deep.eq({ + // verifies the custom `tsconfig.cy.json` is extended + extends: toPosix(path.join(projectRoot, 'tsconfig.cy.json')), + compilerOptions: { + outDir: toPosix(path.join(projectRoot, 'out-tsc/cy')), + allowSyntheticDefaultImports: true, + skipLibCheck: true, + }, + include: [ + toPosix(path.join(projectRoot, 'src/**/*.cy.ts')), + toPosix(supportFile), + toPosix(path.join(projectRoot, 'node_modules/cypress/types/index.d.ts')), + ], + }) } From 058cf22d284effeb38e3e66bbb5c202c156acc65 Mon Sep 17 00:00:00 2001 From: Waldemar Penner Date: Fri, 21 Oct 2022 14:47:19 +0200 Subject: [PATCH 13/23] feat: add support for generating angular component --- .../src/schematics/collection.json | 8 + .../ng-generate/component/index.spec.ts | 39 +++++ .../schematics/ng-generate/component/index.ts | 20 +++ .../ng-generate/component/schema.json | 152 ++++++++++++++++++ 4 files changed, 219 insertions(+) create mode 100644 npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts create mode 100644 npm/cypress-schematic/src/schematics/ng-generate/component/index.ts create mode 100644 npm/cypress-schematic/src/schematics/ng-generate/component/schema.json diff --git a/npm/cypress-schematic/src/schematics/collection.json b/npm/cypress-schematic/src/schematics/collection.json index 8141b0ec54a3..b5f9358df36f 100644 --- a/npm/cypress-schematic/src/schematics/collection.json +++ b/npm/cypress-schematic/src/schematics/collection.json @@ -15,6 +15,14 @@ "description": "Create spec files for all Angular components in a project", "factory": "./ng-generate/cypress-ct-tests/index", "schema": "./ng-generate/cypress-ct-tests/schema.json" + }, + "component": { + "description": "Creates a new, generic component definition in the given or default project.", + "aliases": [ + "c" + ], + "factory": "./ng-generate/component/index", + "schema": "./ng-generate/component/schema.json" } } } diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts b/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts new file mode 100644 index 000000000000..0531bd4e450d --- /dev/null +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts @@ -0,0 +1,39 @@ +import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing' +import { expect } from 'chai' +import { join } from 'path' + +describe('ng-generate @cypress/schematic:component', () => { + const schematicRunner = new SchematicTestRunner( + 'schematics', + join(__dirname, '../../collection.json'), + ) + let appTree: UnitTestTree + + const workspaceOptions = { + name: 'workspace', + newProjectRoot: 'projects', + version: '12.0.0', + } + + const appOptions: Parameters[2] = { + name: 'sandbox', + inlineTemplate: false, + routing: false, + skipTests: false, + skipPackageJson: false, + } + + beforeEach(async () => { + appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise() + appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise() + }) + + it('should create cypress ct alongside the generated component', async () => { + const tree = await schematicRunner.runSchematicAsync('component', { name: 'foo', project: 'sandbox' }, appTree).toPromise() + + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.ts') + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.html') + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.spec.ts') + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.css') + }) +}) diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts b/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts new file mode 100644 index 000000000000..f77ae867617a --- /dev/null +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts @@ -0,0 +1,20 @@ +import { chain, externalSchematic, Rule, SchematicContext, Tree } from '@angular-devkit/schematics' +import cypressTest from '../cypress-test' +import path = require('path'); + +export default function (options: any): Rule { + return (_: Tree, _context: SchematicContext) => { + return chain([ + externalSchematic('@schematics/angular', 'component', options), + (tree: Tree, _context: SchematicContext) => { + return cypressTest({ + ...options, + component: true, + path: tree.actions.filter((a) => a.path.includes(`${options.name}.component.ts`)) + .map((a) => path.dirname(a.path)) + .at(0), + }) + }, + ]) + } +} diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/schema.json b/npm/cypress-schematic/src/schematics/ng-generate/component/schema.json new file mode 100644 index 000000000000..01d8f39925cf --- /dev/null +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/schema.json @@ -0,0 +1,152 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "cypress-schematics-generate-component", + "title": "Cypress Wrapper for Angular Component Options Schema", + "type": "object", + "description": "Creates a new, generic component definition in the given or default project.", + "additionalProperties": false, + "properties": { + "path": { + "type": "string", + "format": "path", + "$default": { + "$source": "workingDirectory" + }, + "description": "The path at which to create the component file, relative to the current workspace. Default is a folder with the same name as the component in the project root.", + "visible": false + }, + "project": { + "type": "string", + "description": "The name of the project.", + "$default": { + "$source": "projectName" + } + }, + "name": { + "type": "string", + "description": "The name of the component.", + "$default": { + "$source": "argv", + "index": 0 + }, + "x-prompt": "What name would you like to use for the component?" + }, + "displayBlock": { + "description": "Specifies if the style will contain `:host { display: block; }`.", + "type": "boolean", + "default": false, + "alias": "b" + }, + "inlineStyle": { + "description": "Include styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file.", + "type": "boolean", + "default": false, + "alias": "s", + "x-user-analytics": "ep.ng_inline_style" + }, + "inlineTemplate": { + "description": "Include template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.", + "type": "boolean", + "default": false, + "alias": "t", + "x-user-analytics": "ep.ng_inline_template" + }, + "standalone": { + "description": "Whether the generated component is standalone.", + "type": "boolean", + "default": false, + "x-user-analytics": "ep.ng_standalone" + }, + "viewEncapsulation": { + "description": "The view encapsulation strategy to use in the new component.", + "enum": [ + "Emulated", + "None", + "ShadowDom" + ], + "type": "string", + "alias": "v" + }, + "changeDetection": { + "description": "The change detection strategy to use in the new component.", + "enum": [ + "Default", + "OnPush" + ], + "type": "string", + "default": "Default", + "alias": "c" + }, + "prefix": { + "type": "string", + "description": "The prefix to apply to the generated component selector.", + "alias": "p", + "oneOf": [ + { + "maxLength": 0 + }, + { + "minLength": 1, + "format": "html-selector" + } + ] + }, + "style": { + "description": "The file extension or preprocessor to use for style files, or 'none' to skip generating the style file.", + "type": "string", + "default": "css", + "enum": [ + "css", + "scss", + "sass", + "less", + "none" + ], + "x-user-analytics": "ep.ng_style" + }, + "type": { + "type": "string", + "description": "Adds a developer-defined type to the filename, in the format \"name.type.ts\".", + "default": "Component" + }, + "skipTests": { + "type": "boolean", + "description": "Do not create \"spec.ts\" test files for the new component.", + "default": false + }, + "flat": { + "type": "boolean", + "description": "Create the new files at the top level of the current project.", + "default": false + }, + "skipImport": { + "type": "boolean", + "description": "Do not import this component into the owning NgModule.", + "default": false + }, + "selector": { + "type": "string", + "format": "html-selector", + "description": "The HTML selector to use for this component." + }, + "skipSelector": { + "type": "boolean", + "default": false, + "description": "Specifies if the component should have a selector or not." + }, + "module": { + "type": "string", + "description": "The declaring NgModule.", + "alias": "m" + }, + "export": { + "type": "boolean", + "default": false, + "description": "The declaring NgModule exports this component." + } + }, + "required": [ + "name", + "project" + ] +} \ No newline at end of file From 60e4adaaac5c221ee005f119212f0c2854843f11 Mon Sep 17 00:00:00 2001 From: Waldemar Penner Date: Sun, 23 Oct 2022 20:04:40 +0200 Subject: [PATCH 14/23] feat: skip default test generation --- .../src/schematics/ng-generate/component/index.spec.ts | 3 ++- .../src/schematics/ng-generate/component/index.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts b/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts index 0531bd4e450d..d64b10d2a1c8 100644 --- a/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts @@ -33,7 +33,8 @@ describe('ng-generate @cypress/schematic:component', () => { expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.ts') expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.html') - expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.spec.ts') + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.cy.ts') expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.css') + expect(tree.files).not.to.contain('/projects/sandbox/src/app/foo/foo.component.spec.ts') }) }) diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts b/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts index f77ae867617a..096e493556fe 100644 --- a/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts @@ -5,7 +5,10 @@ import path = require('path'); export default function (options: any): Rule { return (_: Tree, _context: SchematicContext) => { return chain([ - externalSchematic('@schematics/angular', 'component', options), + externalSchematic('@schematics/angular', 'component', { + ...options, + skipTests: true, + }), (tree: Tree, _context: SchematicContext) => { return cypressTest({ ...options, From 91af0c9e14b6f2551e91e43ecf9f370f155a84ae Mon Sep 17 00:00:00 2001 From: Waldemar Penner Date: Sun, 23 Oct 2022 20:37:12 +0200 Subject: [PATCH 15/23] feat: generate ct tests only if component was generated --- .../schematics/ng-generate/component/index.spec.ts | 11 +++++++++++ .../src/schematics/ng-generate/component/index.ts | 14 ++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts b/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts index d64b10d2a1c8..f55a4ffe2fff 100644 --- a/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts @@ -37,4 +37,15 @@ describe('ng-generate @cypress/schematic:component', () => { expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.css') expect(tree.files).not.to.contain('/projects/sandbox/src/app/foo/foo.component.spec.ts') }) + + it('should not generate component which does exist already', async () => { + let tree = await schematicRunner.runSchematicAsync('component', { name: 'foo', project: 'sandbox' }, appTree).toPromise() + + tree = await schematicRunner.runSchematicAsync('component', { name: 'foo', project: 'sandbox' }, appTree).toPromise() + + expect(tree.files.filter((f) => f === '/projects/sandbox/src/app/foo/foo.component.ts').length).to.eq(1) + expect(tree.files.filter((f) => f === '/projects/sandbox/src/app/foo/foo.component.html').length).to.eq(1) + expect(tree.files.filter((f) => f === '/projects/sandbox/src/app/foo/foo.component.cy.ts').length).to.eq(1) + expect(tree.files.filter((f) => f === '/projects/sandbox/src/app/foo/foo.component.css').length).to.eq(1) + }) }) diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts b/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts index 096e493556fe..d867f2e450c5 100644 --- a/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts @@ -1,4 +1,4 @@ -import { chain, externalSchematic, Rule, SchematicContext, Tree } from '@angular-devkit/schematics' +import { chain, externalSchematic, noop, Rule, SchematicContext, Tree } from '@angular-devkit/schematics' import cypressTest from '../cypress-test' import path = require('path'); @@ -10,13 +10,15 @@ export default function (options: any): Rule { skipTests: true, }), (tree: Tree, _context: SchematicContext) => { - return cypressTest({ + const componentPath = tree.actions.filter((a) => a.path.includes(`${options.name}.component.ts`)) + .map((a) => path.dirname(a.path)) + .at(0) + + return componentPath ? cypressTest({ ...options, component: true, - path: tree.actions.filter((a) => a.path.includes(`${options.name}.component.ts`)) - .map((a) => path.dirname(a.path)) - .at(0), - }) + path: componentPath, + }) : noop() }, ]) } From 5537c82044c3931d3ed2ef5a3e9edc2de5526605 Mon Sep 17 00:00:00 2001 From: Waldemar Penner Date: Mon, 24 Oct 2022 16:52:15 +0200 Subject: [PATCH 16/23] feat: add @cypress/schematic to schematicCollections --- .../src/schematics/ng-add/index.spec.ts | 37 +++++++++++++++++++ .../src/schematics/ng-add/index.ts | 28 ++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/npm/cypress-schematic/src/schematics/ng-add/index.spec.ts b/npm/cypress-schematic/src/schematics/ng-add/index.spec.ts index a83745411981..bef3bf33c0e1 100644 --- a/npm/cypress-schematic/src/schematics/ng-add/index.spec.ts +++ b/npm/cypress-schematic/src/schematics/ng-add/index.spec.ts @@ -3,6 +3,7 @@ import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing' import { join } from 'path' import { expect } from 'chai' +import { JsonObject } from '@angular-devkit/core' describe('@cypress/schematic: ng-add', () => { const schematicRunner = new SchematicTestRunner( @@ -16,6 +17,7 @@ describe('@cypress/schematic: ng-add', () => { name: 'workspace', newProjectRoot: 'projects', version: '6.0.0', + packageManager: 'yarn', } const appOptions = { @@ -26,6 +28,10 @@ describe('@cypress/schematic: ng-add', () => { skipPackageJson: false, } + const readAngularJson = (tree: UnitTestTree) => { + return tree.readJson('/angular.json') as JsonObject + } + beforeEach(async () => { appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise() appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise() @@ -58,4 +64,35 @@ describe('@cypress/schematic: ng-add', () => { expect(files).to.contain('/projects/sandbox/cypress/fixtures/example.json') }) }) + + it('should add @cypress/schematic to the schemaCollections array', async () => { + const tree = await schematicRunner.runSchematicAsync('ng-add', { 'component': true }, appTree).toPromise() + const angularJson = readAngularJson(tree) + const cliOptions = angularJson.cli as JsonObject + + expect(cliOptions).to.eql({ + packageManager: 'yarn', + schematicCollections: ['@cypress/schematic', '@schematics/angular'], + }) + }) + + it('should not overwrite existing schemaCollections array', async () => { + let angularJson = readAngularJson(appTree) + + appTree.overwrite('./angular.json', JSON.stringify({ + ...angularJson, + cli: { + schematicCollections: ['@any/schematic'], + }, + })) + + const tree = await schematicRunner.runSchematicAsync('ng-add', { 'component': true }, appTree).toPromise() + + angularJson = readAngularJson(tree) + const cliOptions = angularJson.cli as JsonObject + + expect(cliOptions).to.eql({ + schematicCollections: ['@cypress/schematic', '@any/schematic', '@schematics/angular'], + }) + }) }) diff --git a/npm/cypress-schematic/src/schematics/ng-add/index.ts b/npm/cypress-schematic/src/schematics/ng-add/index.ts index 8a7953377e99..d3c0dcfd198f 100644 --- a/npm/cypress-schematic/src/schematics/ng-add/index.ts +++ b/npm/cypress-schematic/src/schematics/ng-add/index.ts @@ -45,6 +45,7 @@ export default function (_options: any): Rule { addCtSpecs(_options), addCypressTestScriptsToPackageJson(), modifyAngularJson(_options), + addDefaultSchematic(), ])(tree, _context) } } @@ -306,6 +307,33 @@ function modifyAngularJson (options: any): Rule { } } +function addDefaultSchematic (): Rule { + return (tree: Tree, _: SchematicContext) => { + if (tree.exists('./angular.json')) { + const angularJsonVal = getAngularJsonValue(tree) + const angularSchematic = '@schematics/angular' + const cli = { + ...angularJsonVal.cli, + schematicCollections: ['@cypress/schematic', ...angularJsonVal?.cli?.schematicCollections ?? []], + } + + if (cli.schematicCollections.indexOf('@schematics/angular') === -1) { + cli.schematicCollections.push(angularSchematic) + } + + return tree.overwrite( + './angular.json', + JSON.stringify({ + ...angularJsonVal, + cli, + }, null, 2), + ) + } + + throw new SchematicsException('angular.json not found') + } +} + export const getCypressConfigFile = (angularJsonVal: any, projectName: string) => { const project = angularJsonVal.projects[projectName] const tsConfig = project?.architect?.lint?.options?.tsConfig From a82f7936e333ea49118c00a94b178e5357341bbf Mon Sep 17 00:00:00 2001 From: Waldemar Penner Date: Mon, 24 Oct 2022 17:46:58 +0200 Subject: [PATCH 17/23] feat: add documentation --- npm/cypress-schematic/README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/npm/cypress-schematic/README.md b/npm/cypress-schematic/README.md index bd61e4828164..99e28271da0e 100644 --- a/npm/cypress-schematic/README.md +++ b/npm/cypress-schematic/README.md @@ -49,6 +49,8 @@ To install the schematic via cli arguments (installs both e2e and component test ng add @cypress/schematic --e2e --component ``` +The installation will add the schematic to the [default schematic collections](https://angular.io/guide/workspace-config#angular-cli-configuration-options). This allows you to execute the CLI commands without prefixing them with the package name. + To run Cypress in `open` mode within your project: ```shell script @@ -78,37 +80,43 @@ ng run {project-name}:ct To generate a new e2e spec file: ```shell script -ng generate @cypress/schematic:spec +ng generate spec ``` or (without cli prompt) ```shell script -ng generate @cypress/schematic:spec {name} +ng generate spec {name} ``` To generate a new component spec file: ```shell script -ng generate @cypress/schematic:spec --component +ng generate spec --component ``` or (without cli prompt) ```shell script -ng generate @cypress/schematic:spec {component name} --component +ng generate spec {component name} --component ``` To generate a new component spec file in a specific folder: ```shell script -ng generate @cypress/schematic:spec {component name} --component --path {path relative to project root} +ng generate spec {component name} --component --path {path relative to project root} ``` To generate new component spec files alongside all component files in a project: ```shell script -ng generate @cypress/schematic:specs-ct +ng generate specs-ct +``` + +To generate a new, generic component definition with a component spec file in the given or default project. This wraps the [Angular CLI Component Generator](https://angular.io/cli/generate#component) and supports the same arguments accordingly. + +```shell script +ng generate component {component name} ``` ## Builder Options 🛠 From 7beb9f15b94819aa06ff9b0f352e19edb7b0ef23 Mon Sep 17 00:00:00 2001 From: Waldemar Penner Date: Tue, 25 Oct 2022 07:29:25 +0200 Subject: [PATCH 18/23] docs: document component generation --- npm/cypress-schematic/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/npm/cypress-schematic/README.md b/npm/cypress-schematic/README.md index 99e28271da0e..1ce0bc1aa23e 100644 --- a/npm/cypress-schematic/README.md +++ b/npm/cypress-schematic/README.md @@ -49,7 +49,7 @@ To install the schematic via cli arguments (installs both e2e and component test ng add @cypress/schematic --e2e --component ``` -The installation will add the schematic to the [default schematic collections](https://angular.io/guide/workspace-config#angular-cli-configuration-options). This allows you to execute the CLI commands without prefixing them with the package name. +The installation will add this schematic to the [default schematic collections](https://angular.io/guide/workspace-config#angular-cli-configuration-options). This allows you to execute the CLI commands without prefixing them with the package name. To run Cypress in `open` mode within your project: @@ -113,7 +113,7 @@ To generate new component spec files alongside all component files in a project: ng generate specs-ct ``` -To generate a new, generic component definition with a component spec file in the given or default project. This wraps the [Angular CLI Component Generator](https://angular.io/cli/generate#component) and supports the same arguments accordingly. +To generate a new, generic component definition with a component spec file in the given or default project. This wraps the [Angular CLI Component Generator](https://angular.io/cli/generate#component) and supports the same arguments. ```shell script ng generate component {component name} From dffdd3457b0023237529fc388894a9b4524a442f Mon Sep 17 00:00:00 2001 From: Waldemar Penner Date: Fri, 28 Oct 2022 22:05:30 +0200 Subject: [PATCH 19/23] add test --- npm/cypress-schematic/src/ct.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/npm/cypress-schematic/src/ct.spec.ts b/npm/cypress-schematic/src/ct.spec.ts index 9cf4511c3ac9..331a0498d519 100644 --- a/npm/cypress-schematic/src/ct.spec.ts +++ b/npm/cypress-schematic/src/ct.spec.ts @@ -49,5 +49,15 @@ describe('ng add @cypress/schematic / e2e and ct', function () { await copyAngularMount(projectPath) await runCommandInProject('yarn ng run angular:ct --watch false --spec src/app/app.component.cy.ts', projectPath) }) + + it('should generate component alongside component spec', async () => { + const projectPath = await scaffoldAngularProject(project) + + await runCommandInProject(`yarn add @cypress/schematic@file:${cypressSchematicPackagePath}`, projectPath) + await runCommandInProject('yarn ng add @cypress/schematic --e2e --component', projectPath) + await copyAngularMount(projectPath) + await runCommandInProject('yarn ng generate c foo', projectPath) + await runCommandInProject('yarn ng run angular:ct --watch false --spec src/app/foo/foo.component.cy.ts', projectPath) + }) } }) From dd2cf7a87e4ce277bf2ab4a6190a0b457282c3bc Mon Sep 17 00:00:00 2001 From: Zachary Williams Date: Tue, 22 Nov 2022 11:28:53 -0600 Subject: [PATCH 20/23] fix generate from component with dir --- .../src/schematics/ng-generate/component/index.spec.ts | 9 +++++++++ .../src/schematics/ng-generate/component/index.ts | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts b/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts index f55a4ffe2fff..2c60abc2cf65 100644 --- a/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts @@ -48,4 +48,13 @@ describe('ng-generate @cypress/schematic:component', () => { expect(tree.files.filter((f) => f === '/projects/sandbox/src/app/foo/foo.component.cy.ts').length).to.eq(1) expect(tree.files.filter((f) => f === '/projects/sandbox/src/app/foo/foo.component.css').length).to.eq(1) }) + + it('should generate component given a component containing a directory', async () => { + const tree = await schematicRunner.runSchematicAsync('component', { name: 'foo/bar', project: 'sandbox' }, appTree).toPromise() + + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/bar/bar.component.ts') + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/bar/bar.component.html') + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/bar/bar.component.cy.ts') + expect(tree.files).to.contain('/projects/sandbox/src/app/foo/bar/bar.component.css') + }) }) diff --git a/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts b/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts index d867f2e450c5..5f926c54a65e 100644 --- a/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts +++ b/npm/cypress-schematic/src/schematics/ng-generate/component/index.ts @@ -10,7 +10,8 @@ export default function (options: any): Rule { skipTests: true, }), (tree: Tree, _context: SchematicContext) => { - const componentPath = tree.actions.filter((a) => a.path.includes(`${options.name}.component.ts`)) + const componentName = path.parse(options.name).name + const componentPath = tree.actions.filter((a) => a.path.includes(`${componentName}.component.ts`)) .map((a) => path.dirname(a.path)) .at(0) @@ -18,6 +19,7 @@ export default function (options: any): Rule { ...options, component: true, path: componentPath, + name: componentName, }) : noop() }, ]) From 4fb5b579a742dbdb66a8af0435b4fc41d69f7f68 Mon Sep 17 00:00:00 2001 From: astone123 Date: Tue, 22 Nov 2022 14:26:24 -0500 Subject: [PATCH 21/23] fix CI --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 545b328b2e8e..1889f9ef84c4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -109,11 +109,13 @@ executors: resource_class: windows.large environment: PLATFORM: windows + CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' darwin-arm64: &darwin-arm64-executor machine: true environment: PLATFORM: darwin + CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' linux-arm64: &linux-arm64-executor machine: @@ -123,6 +125,7 @@ executors: PLATFORM: linux # TODO: Disabling snapshots for now on Linux Arm 64 architectures. Will revisit with https://github.com/cypress-io/cypress/issues/23557 DISABLE_SNAPSHOT_REQUIRE: 1 + CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' commands: verify_should_persist_artifacts: From 1c93b03a996f351c09dd56a9e6bca3607b172507 Mon Sep 17 00:00:00 2001 From: astone123 Date: Tue, 22 Nov 2022 15:12:27 -0500 Subject: [PATCH 22/23] add variable to job defaults --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1889f9ef84c4..4523a1f75976 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,6 +22,9 @@ defaults: &defaults COLUMNS: 100 LINES: 24 + ## don't print commercial messages so that our snapshots are consistent + CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' + mainBuildFilters: &mainBuildFilters filters: branches: @@ -109,13 +112,11 @@ executors: resource_class: windows.large environment: PLATFORM: windows - CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' darwin-arm64: &darwin-arm64-executor machine: true environment: PLATFORM: darwin - CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' linux-arm64: &linux-arm64-executor machine: @@ -125,7 +126,6 @@ executors: PLATFORM: linux # TODO: Disabling snapshots for now on Linux Arm 64 architectures. Will revisit with https://github.com/cypress-io/cypress/issues/23557 DISABLE_SNAPSHOT_REQUIRE: 1 - CYPRESS_COMMERCIAL_RECOMMENDATIONS: '0' commands: verify_should_persist_artifacts: From a3c3e6fa97b13b9a75cfa903c39d159849e15c2f Mon Sep 17 00:00:00 2001 From: Zachary Williams Date: Mon, 23 Jan 2023 13:43:25 -0600 Subject: [PATCH 23/23] remove v13 support --- npm/cypress-schematic/README.md | 2 +- npm/cypress-schematic/package.json | 12 ++++---- npm/cypress-schematic/src/ct.spec.ts | 2 +- npm/cypress-schematic/src/e2e.spec.ts | 2 +- yarn.lock | 43 +++++++++++++++++++++++---- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/npm/cypress-schematic/README.md b/npm/cypress-schematic/README.md index d4c09b6f4e27..71be26beeaa1 100644 --- a/npm/cypress-schematic/README.md +++ b/npm/cypress-schematic/README.md @@ -31,7 +31,7 @@ ## Requirements -- Angular 13+ +- Angular 14+ ## Usage ⏯ diff --git a/npm/cypress-schematic/package.json b/npm/cypress-schematic/package.json index eb63ce1f7e9d..bc5e98c58956 100644 --- a/npm/cypress-schematic/package.json +++ b/npm/cypress-schematic/package.json @@ -10,16 +10,16 @@ "lint": "eslint --ext .ts,.json, ." }, "dependencies": { - "@angular-devkit/architect": "^0.1402.1", - "@angular-devkit/core": "^14.2.1", - "@angular-devkit/schematics": "^14.2.1", - "@schematics/angular": "^14.2.1", "jsonc-parser": "^3.0.0", "rxjs": "~6.6.0" }, "devDependencies": { + "@angular-devkit/architect": "^0.1402.1", + "@angular-devkit/core": "^14.2.1", + "@angular-devkit/schematics": "^14.2.1", "@angular-devkit/schematics-cli": "^14.2.1", "@angular/cli": "^14.2.1", + "@schematics/angular": "^14.2.1", "@types/chai-enzyme": "0.6.7", "@types/mocha": "8.0.3", "@types/node": "^18.0.6", @@ -28,8 +28,8 @@ "typescript": "^4.7.4" }, "peerDependencies": { - "@angular/cli": ">=12", - "@angular/core": ">=12" + "@angular/cli": ">=14", + "@angular/core": ">=14" }, "license": "MIT", "repository": { diff --git a/npm/cypress-schematic/src/ct.spec.ts b/npm/cypress-schematic/src/ct.spec.ts index 5b7c6a3aeae9..0e1929dd3be4 100644 --- a/npm/cypress-schematic/src/ct.spec.ts +++ b/npm/cypress-schematic/src/ct.spec.ts @@ -35,7 +35,7 @@ const copyAngularMount = async (projectPath: string) => { const cypressSchematicPackagePath = path.join(__dirname, '..') -const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-13', 'angular-14'] +const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-14', 'angular-15'] describe('ng add @cypress/schematic / e2e and ct', function () { this.timeout(1000 * 60 * 5) diff --git a/npm/cypress-schematic/src/e2e.spec.ts b/npm/cypress-schematic/src/e2e.spec.ts index e65ce18c5781..bd231bc8ea7f 100644 --- a/npm/cypress-schematic/src/e2e.spec.ts +++ b/npm/cypress-schematic/src/e2e.spec.ts @@ -24,7 +24,7 @@ const runCommandInProject = (command: string, projectPath: string) => { const cypressSchematicPackagePath = path.join(__dirname, '..') -const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-13', 'angular-14'] +const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-14', 'angular-15'] describe('ng add @cypress/schematic / only e2e', function () { this.timeout(1000 * 60 * 5) diff --git a/yarn.lock b/yarn.lock index 0b0a4e7a1b80..5c4aa12a65e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -22,7 +22,7 @@ "@angular-devkit/core" "14.2.1" rxjs "6.6.7" -"@angular-devkit/core@14.2.1", "@angular-devkit/core@^14.2.1": +"@angular-devkit/core@14.2.1": version "14.2.1" resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.2.1.tgz#7ce14efdb5fce687bb4f13bef03d4b67e971b22e" integrity sha512-lW8oNGuJqr4r31FWBjfWQYkSXdiOHBGOThIEtHvUVBKfPF/oVrupLueCUgBPel+NvxENXdo93uPsqHN7bZbmsQ== @@ -33,6 +33,17 @@ rxjs "6.6.7" source-map "0.7.4" +"@angular-devkit/core@14.2.10", "@angular-devkit/core@^14.2.1": + version "14.2.10" + resolved "https://registry.yarnpkg.com/@angular-devkit/core/-/core-14.2.10.tgz#9eedb7cf783030252f0c7546ce80fc321633b499" + integrity sha512-K4AO7mROTdbhQ7chtyQd6oPwmuL+BPUh+wn6Aq1qrmYJK4UZYFOPp8fi/Ehs8meCEeywtrssOPfrOE4Gsre9dg== + dependencies: + ajv "8.11.0" + ajv-formats "2.1.1" + jsonc-parser "3.1.0" + rxjs "6.6.7" + source-map "0.7.4" + "@angular-devkit/schematics-cli@^14.2.1": version "14.2.1" resolved "https://registry.yarnpkg.com/@angular-devkit/schematics-cli/-/schematics-cli-14.2.1.tgz#cbea1e4a47880ee4e3eb4816d25a104b4f9fcc10" @@ -45,7 +56,7 @@ symbol-observable "4.0.0" yargs-parser "21.1.1" -"@angular-devkit/schematics@14.2.1", "@angular-devkit/schematics@^14.2.1": +"@angular-devkit/schematics@14.2.1": version "14.2.1" resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-14.2.1.tgz#9d66080e60ab32d1b44c854cabc8f5cbb421d877" integrity sha512-0U18FwDYt4zROBPrvewH6iBTkf2ozVHN4/gxUb9jWrqVw8mPU5AWc/iYxQLHBSinkr2Egjo1H/i9aBqgJSeh3g== @@ -56,6 +67,17 @@ ora "5.4.1" rxjs "6.6.7" +"@angular-devkit/schematics@14.2.10", "@angular-devkit/schematics@^14.2.1": + version "14.2.10" + resolved "https://registry.yarnpkg.com/@angular-devkit/schematics/-/schematics-14.2.10.tgz#91fcc85199aa7fa9a3a0cb49d8a5266421f9d5e3" + integrity sha512-MMp31KpJTwKHisXOq+6VOXYApq97hZxFaFmZk396X5aIFTCELUwjcezQDk+u2nEs5iK/COUfnN3plGcfJxYhQA== + dependencies: + "@angular-devkit/core" "14.2.10" + jsonc-parser "3.1.0" + magic-string "0.26.2" + ora "5.4.1" + rxjs "6.6.7" + "@angular/cli@^14.2.1": version "14.2.1" resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-14.2.1.tgz#1e4faabf537c2686c34487e3fa3b03affbb31a01" @@ -5729,7 +5751,7 @@ dependencies: any-observable "^0.3.0" -"@schematics/angular@14.2.1", "@schematics/angular@^14.2.1": +"@schematics/angular@14.2.1": version "14.2.1" resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-14.2.1.tgz#00f54cb6b30dc1945b6d344ca225c04dcc12f682" integrity sha512-Dchixep/FMETAMuyFchw9Nryi7tfuZQRumzIOtQpv+KaVtfjvcIlES0KuI0U3Qh7tGIYPBmO3Mkt3oojcl2RBA== @@ -5738,6 +5760,15 @@ "@angular-devkit/schematics" "14.2.1" jsonc-parser "3.1.0" +"@schematics/angular@^14.2.1": + version "14.2.10" + resolved "https://registry.yarnpkg.com/@schematics/angular/-/angular-14.2.10.tgz#676b045ea647e8908ade169ebb688e40b158ca83" + integrity sha512-YFTc/9QJdx422XcApizEcVLKoyknu8b9zHIlAepZCu7WkV8GPT0hvVEHQ7KBWys5aQ7pPZMT0JpZLeAz0F2xYQ== + dependencies: + "@angular-devkit/core" "14.2.10" + "@angular-devkit/schematics" "14.2.10" + jsonc-parser "3.1.0" + "@semantic-release/changelog@5.0.1": version "5.0.1" resolved "https://registry.yarnpkg.com/@semantic-release/changelog/-/changelog-5.0.1.tgz#50a84b63e5d391b7debfe021421589fa2bcdafe4" @@ -29798,9 +29829,9 @@ rxjs@6.6.7, rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.5.4, rxjs@^6.6.0, rxjs@^6.6.3, rxj tslib "^1.9.0" rxjs@^7.1.0, rxjs@^7.5.5: - version "7.5.6" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.6.tgz#0446577557862afd6903517ce7cae79ecb9662bc" - integrity sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw== + version "7.5.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" + integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA== dependencies: tslib "^2.1.0"