Skip to content

Commit 74f853b

Browse files
committed
breaking: remove support for angular 13,14,15, and 16. minimum version is now 17.2.0
breaking: cypress-schematic only supports angular 17.2.0 and up [run ci] fix updates missed [run ci]
1 parent 11f3355 commit 74f853b

File tree

84 files changed

+20159
-38941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+20159
-38941
lines changed

cli/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ _Released 12/3/2024 (PENDING)_
2020
- Cypress Component Testing no longer supports `Nuxt.js` version 2. Addresses [#30468](https://github.com/cypress-io/cypress/issues/30468).
2121
- Cypress Component Testing no longer supports `Vue` version 2. Addresses [#30295](https://github.com/cypress-io/cypress/issues/30295).
2222
- Cypress Component Testing no longer supports `Next.js` versions 10, 11, 12, and 13. Addresses [#29583](https://github.com/cypress-io/cypress/issues/29583).
23+
- Cypress Component Testing no longer supports `Angular` versions 13, 14, 15, and 16. The minimum supported version is now `17.2.0` in order to fully support Angular [signals](https://angular.dev/guide/signals). Addresses [#29582](https://github.com/cypress-io/cypress/issues/29582). Addressed in [#30539](https://github.com/cypress-io/cypress/pull/30539).
2324

2425
**Deprecations:**
2526

npm/angular/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
},
1313
"dependencies": {},
1414
"devDependencies": {
15-
"@angular/common": "^14.2.0",
16-
"@angular/core": "^14.2.0",
17-
"@angular/platform-browser-dynamic": "^14.2.0",
15+
"@angular/common": "^17.2.0",
16+
"@angular/core": "^17.2.0",
17+
"@angular/platform-browser-dynamic": "^17.2.0",
1818
"@cypress/mount-utils": "0.0.0-development",
1919
"typescript": "~5.4.5",
2020
"zone.js": "~0.11.4"
2121
},
2222
"peerDependencies": {
23-
"@angular/common": ">=13",
24-
"@angular/core": ">=13",
25-
"@angular/platform-browser-dynamic": ">=13",
23+
"@angular/common": ">=17.2",
24+
"@angular/core": ">=17.2",
25+
"@angular/platform-browser-dynamic": ">=17.2",
2626
"zone.js": ">=0.11.0"
2727
},
2828
"files": [

npm/cypress-schematic/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
## Requirements
3333

34-
- Angular 14+
34+
- Angular 17.2.0+
3535

3636
## Usage ⏯
3737

npm/cypress-schematic/package.json

+14-15
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,28 @@
77
"build": "tsc -p tsconfig.json",
88
"build:watch": "tsc -p tsconfig.json --watch",
99
"lint": "eslint --ext .ts,.json, .",
10-
"test": "mocha -r @packages/ts/register --reporter mocha-multi-reporters --reporter-options configFile=../../mocha-reporter-config.json src/**/*.spec.ts"
10+
"test": "vitest run --no-file-parallelism"
1111
},
1212
"dependencies": {
13-
"jsonc-parser": "^3.0.0",
14-
"rxjs": "~6.6.0"
13+
"jsonc-parser": "^3.3.1",
14+
"rxjs": "~7.8.1"
1515
},
1616
"devDependencies": {
17-
"@angular-devkit/architect": "^0.1402.1",
18-
"@angular-devkit/core": "^14.2.1",
19-
"@angular-devkit/schematics": "^14.2.1",
20-
"@angular-devkit/schematics-cli": "^14.2.1",
21-
"@angular/cli": "^14.2.1",
22-
"@schematics/angular": "^14.2.1",
23-
"@types/chai-enzyme": "0.6.7",
17+
"@angular-devkit/architect": "^0.1802.11",
18+
"@angular-devkit/core": "^18.2.11",
19+
"@angular-devkit/schematics": "^18.2.11",
20+
"@angular-devkit/schematics-cli": "^18.2.11",
21+
"@angular/cli": "^18.2.11",
22+
"@schematics/angular": "^18.2.11",
23+
"@types/chai-enzyme": "0.6.13",
2424
"@types/mocha": "8.0.3",
2525
"@types/node": "^20.16.0",
26-
"chai": "4.2.0",
27-
"mocha": "3.5.3",
28-
"typescript": "~5.4.5"
26+
"typescript": "~5.4.5",
27+
"vitest": "2.1.4"
2928
},
3029
"peerDependencies": {
31-
"@angular/cli": ">=14",
32-
"@angular/core": ">=14"
30+
"@angular/cli": ">=17.2",
31+
"@angular/core": ">=17.2"
3332
},
3433
"license": "MIT",
3534
"repository": {

npm/cypress-schematic/src/ct.spec.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it } from 'vitest'
12
import Fixtures, { ProjectFixtureDir } from '@tooling/system-tests'
23
import * as FixturesScaffold from '@tooling/system-tests/lib/dep-installer'
34
import execa from 'execa'
@@ -35,11 +36,9 @@ const copyAngularMount = async (projectPath: string) => {
3536

3637
const cypressSchematicPackagePath = path.join(__dirname, '..')
3738

38-
const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-14', 'angular-15']
39-
40-
describe('ng add @cypress/schematic / e2e and ct', function () {
41-
this.timeout(1000 * 60 * 5)
39+
const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-17', 'angular-18']
4240

41+
describe('ng add @cypress/schematic / e2e and ct', { timeout: 1000 * 60 * 5 }, function () {
4342
for (const project of ANGULAR_PROJECTS) {
4443
it('should install ct files with option and no component specs', async () => {
4544
const projectPath = await scaffoldAngularProject(project)

npm/cypress-schematic/src/e2e.spec.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it } from 'vitest'
12
import Fixtures, { ProjectFixtureDir } from '@tooling/system-tests'
23
import * as FixturesScaffold from '@tooling/system-tests/lib/dep-installer'
34
import execa from 'execa'
@@ -24,11 +25,9 @@ const runCommandInProject = (command: string, projectPath: string) => {
2425

2526
const cypressSchematicPackagePath = path.join(__dirname, '..')
2627

27-
const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-14', 'angular-15']
28-
29-
describe('ng add @cypress/schematic / only e2e', function () {
30-
this.timeout(1000 * 60 * 5)
28+
const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-17', 'angular-18']
3129

30+
describe('ng add @cypress/schematic / only e2e', { timeout: 1000 * 60 * 5 }, function () {
3231
for (const project of ANGULAR_PROJECTS) {
3332
it('should install e2e files by default', async () => {
3433
const projectPath = await scaffoldAngularProject(project)

npm/cypress-schematic/src/schematics/ng-add/index.spec.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
/// <reference path="../../../../../cli/types/mocha/index.d.ts" />
2-
1+
import { describe, beforeEach, it, expect } from 'vitest'
32
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'
43
import { join } from 'path'
5-
import { expect } from 'chai'
64
import { JsonObject } from '@angular-devkit/core'
75

86
describe('@cypress/schematic: ng-add', () => {
@@ -33,12 +31,12 @@ describe('@cypress/schematic: ng-add', () => {
3331
}
3432

3533
beforeEach(async () => {
36-
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise()
37-
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise()
34+
appTree = await schematicRunner.runExternalSchematic('@schematics/angular', 'workspace', workspaceOptions)
35+
appTree = await schematicRunner.runExternalSchematic('@schematics/angular', 'application', appOptions, appTree)
3836
})
3937

4038
it('should create cypress files for e2e testing by default', async () => {
41-
await schematicRunner.runSchematicAsync('ng-add', {}, appTree).toPromise().then((tree: UnitTestTree) => {
39+
await schematicRunner.runSchematic('ng-add', {}, appTree).then((tree: UnitTestTree) => {
4240
const files = tree.files
4341

4442
expect(files).to.contain('/projects/sandbox/cypress/e2e/spec.cy.ts')
@@ -51,7 +49,7 @@ describe('@cypress/schematic: ng-add', () => {
5149
})
5250

5351
it('should create cypress files for component testing', async () => {
54-
await schematicRunner.runSchematicAsync('ng-add', { 'component': true }, appTree).toPromise().then((tree: UnitTestTree) => {
52+
await schematicRunner.runSchematic('ng-add', { 'component': true }, appTree).then((tree: UnitTestTree) => {
5553
const files = tree.files
5654

5755
expect(files).to.contain('/projects/sandbox/cypress/support/component.ts')
@@ -66,7 +64,7 @@ describe('@cypress/schematic: ng-add', () => {
6664
})
6765

6866
it('should add @cypress/schematic to the schemaCollections array', async () => {
69-
const tree = await schematicRunner.runSchematicAsync('ng-add', { 'component': true }, appTree).toPromise()
67+
const tree = await schematicRunner.runSchematic('ng-add', { 'component': true }, appTree)
7068
const angularJson = readAngularJson(tree)
7169
const cliOptions = angularJson.cli as JsonObject
7270

@@ -86,7 +84,7 @@ describe('@cypress/schematic: ng-add', () => {
8684
},
8785
}))
8886

89-
const tree = await schematicRunner.runSchematicAsync('ng-add', { 'component': true }, appTree).toPromise()
87+
const tree = await schematicRunner.runSchematic('ng-add', { 'component': true }, appTree)
9088

9189
angularJson = readAngularJson(tree)
9290
const cliOptions = angularJson.cli as JsonObject

npm/cypress-schematic/src/schematics/ng-generate/component/index.spec.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { describe, beforeEach, it, expect } from 'vitest'
12
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'
2-
import { expect } from 'chai'
33
import { join } from 'path'
44

55
describe('ng-generate @cypress/schematic:component', () => {
@@ -12,10 +12,10 @@ describe('ng-generate @cypress/schematic:component', () => {
1212
const workspaceOptions = {
1313
name: 'workspace',
1414
newProjectRoot: 'projects',
15-
version: '12.0.0',
15+
version: '18.0.0',
1616
}
1717

18-
const appOptions: Parameters<typeof schematicRunner['runExternalSchematicAsync']>[2] = {
18+
const appOptions: Parameters<typeof schematicRunner['runExternalSchematic']>[2] = {
1919
name: 'sandbox',
2020
inlineTemplate: false,
2121
routing: false,
@@ -24,12 +24,12 @@ describe('ng-generate @cypress/schematic:component', () => {
2424
}
2525

2626
beforeEach(async () => {
27-
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise()
28-
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise()
27+
appTree = await schematicRunner.runExternalSchematic('@schematics/angular', 'workspace', workspaceOptions)
28+
appTree = await schematicRunner.runExternalSchematic('@schematics/angular', 'application', appOptions, appTree)
2929
})
3030

3131
it('should create cypress ct alongside the generated component', async () => {
32-
const tree = await schematicRunner.runSchematicAsync('component', { name: 'foo', project: 'sandbox' }, appTree).toPromise()
32+
const tree = await schematicRunner.runSchematic('component', { name: 'foo', project: 'sandbox', skipImport: true }, appTree)
3333

3434
expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.ts')
3535
expect(tree.files).to.contain('/projects/sandbox/src/app/foo/foo.component.html')
@@ -39,9 +39,9 @@ describe('ng-generate @cypress/schematic:component', () => {
3939
})
4040

4141
it('should not generate component which does exist already', async () => {
42-
let tree = await schematicRunner.runSchematicAsync('component', { name: 'foo', project: 'sandbox' }, appTree).toPromise()
42+
let tree = await schematicRunner.runSchematic('component', { name: 'foo', project: 'sandbox', skipImport: true }, appTree)
4343

44-
tree = await schematicRunner.runSchematicAsync('component', { name: 'foo', project: 'sandbox' }, appTree).toPromise()
44+
tree = await schematicRunner.runSchematic('component', { name: 'foo', project: 'sandbox', skipImport: true }, appTree)
4545

4646
expect(tree.files.filter((f) => f === '/projects/sandbox/src/app/foo/foo.component.ts').length).to.eq(1)
4747
expect(tree.files.filter((f) => f === '/projects/sandbox/src/app/foo/foo.component.html').length).to.eq(1)
@@ -50,7 +50,7 @@ describe('ng-generate @cypress/schematic:component', () => {
5050
})
5151

5252
it('should generate component given a component containing a directory', async () => {
53-
const tree = await schematicRunner.runSchematicAsync('component', { name: 'foo/bar', project: 'sandbox' }, appTree).toPromise()
53+
const tree = await schematicRunner.runSchematic('component', { name: 'foo/bar', project: 'sandbox', skipImport: true }, appTree)
5454

5555
expect(tree.files).to.contain('/projects/sandbox/src/app/foo/bar/bar.component.ts')
5656
expect(tree.files).to.contain('/projects/sandbox/src/app/foo/bar/bar.component.html')
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
/// <reference path="../../../../../../cli/types/mocha/index.d.ts" />
2-
1+
import { describe, it, beforeEach, expect } from 'vitest'
32
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'
43
import { join } from 'path'
5-
import { expect } from 'chai'
6-
import { take } from 'rxjs/operators'
74

85
describe('ng-generate @cypress/schematic:specs-ct', () => {
96
const schematicRunner = new SchematicTestRunner(
@@ -15,10 +12,10 @@ describe('ng-generate @cypress/schematic:specs-ct', () => {
1512
const workspaceOptions = {
1613
name: 'workspace',
1714
newProjectRoot: 'projects',
18-
version: '12.0.0',
15+
version: '18.0.0',
1916
}
2017

21-
const appOptions: Parameters<typeof schematicRunner['runExternalSchematicAsync']>[2] = {
18+
const appOptions: Parameters<typeof schematicRunner['runExternalSchematic']>[2] = {
2219
name: 'sandbox',
2320
inlineTemplate: false,
2421
routing: false,
@@ -27,11 +24,13 @@ describe('ng-generate @cypress/schematic:specs-ct', () => {
2724
}
2825

2926
beforeEach(async () => {
30-
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise()
31-
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise()
27+
appTree = await schematicRunner.runExternalSchematic('@schematics/angular', 'workspace', workspaceOptions)
28+
appTree = await schematicRunner.runExternalSchematic('@schematics/angular', 'application', appOptions, appTree)
3229
})
3330

3431
it('should create cypress component tests alongside components', async () => {
35-
return schematicRunner.runSchematicAsync('specs-ct', { project: 'sandbox' }, appTree).pipe(take(1)).subscribe((tree: UnitTestTree) => expect(tree.files).to.contain('/projects/sandbox/app/src/app.component.cy.ts'))
32+
const tree = await schematicRunner.runSchematic('specs-ct', { project: 'sandbox' }, appTree)
33+
34+
expect(tree.files).to.contain('/projects/sandbox/src/fake-component.component.cy.ts')
3635
})
3736
})
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
/// <reference path="../../../../../../cli/types/mocha/index.d.ts" />
2-
1+
import { describe, it, beforeEach, expect } from 'vitest'
32
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'
43
import { join } from 'path'
5-
import { expect } from 'chai'
64

75
describe('ng-generate @cypress/schematic:spec', () => {
86
const schematicRunner = new SchematicTestRunner(
@@ -17,7 +15,7 @@ describe('ng-generate @cypress/schematic:spec', () => {
1715
version: '12.0.0',
1816
}
1917

20-
const appOptions: Parameters<typeof schematicRunner['runExternalSchematicAsync']>[2] = {
18+
const appOptions: Parameters<typeof schematicRunner['runExternalSchematic']>[2] = {
2119
name: 'sandbox',
2220
inlineTemplate: false,
2321
routing: false,
@@ -26,15 +24,19 @@ describe('ng-generate @cypress/schematic:spec', () => {
2624
}
2725

2826
beforeEach(async () => {
29-
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise()
30-
appTree = await schematicRunner.runExternalSchematicAsync('@schematics/angular', 'application', appOptions, appTree).toPromise()
27+
appTree = await schematicRunner.runExternalSchematic('@schematics/angular', 'workspace', workspaceOptions)
28+
appTree = await schematicRunner.runExternalSchematic('@schematics/angular', 'application', appOptions, appTree)
3129
})
3230

3331
it('should create cypress e2e spec file by default', async () => {
34-
await schematicRunner.runSchematicAsync('spec', { name: 'foo', project: 'sandbox' }, appTree).toPromise().then((tree: UnitTestTree) => expect(tree.files).to.contain('/projects/sandbox/cypress/e2e/foo.cy.ts'))
32+
const tree = await schematicRunner.runSchematic('spec', { name: 'foo', project: 'sandbox' }, appTree)
33+
34+
expect(tree.files).to.contain('/projects/sandbox/cypress/e2e/foo.cy.ts')
3535
})
3636

3737
it('should create cypress ct spec file when testingType is component', async () => {
38-
await schematicRunner.runSchematicAsync('spec', { name: 'foo', project: 'sandbox', component: true }, appTree).toPromise().then((tree: UnitTestTree) => expect(tree.files).to.contain('/projects/sandbox/src/app/foo.component.cy.ts'))
38+
const tree = await schematicRunner.runSchematic('spec', { name: 'foo', project: 'sandbox', component: true }, appTree)
39+
40+
expect(tree.files).to.contain('/projects/sandbox/src/app/foo.component.cy.ts')
3941
})
4042
})

npm/webpack-dev-server/cypress/e2e/angular.cy.ts

+13-19
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
import type { ProjectFixtureDir } from '@tooling/system-tests/lib/fixtureDirs'
44

55
const WEBPACK_ANGULAR: ProjectFixtureDir[] = [
6-
'angular-13',
7-
'angular-14',
8-
'angular-15',
9-
'angular-16',
106
'angular-17',
117
'angular-18',
128
]
@@ -26,22 +22,20 @@ for (const project of WEBPACK_ANGULAR) {
2622
})
2723

2824
describe('configuration handling', () => {
29-
if (!['angular-13', 'angular-14'].includes(project)) {
30-
it('should initialize with unsupported browserslist entries', () => {
31-
// Create .browerslistrc that requests support for ES5
32-
// Support was dropped in Angular CLI v15 so this should generate a warning message in that version and beyond
33-
cy.withCtx(async (ctx) => {
34-
await ctx.actions.file.writeFileInProject(
35-
ctx.path.resolve('.browserslistrc'),
36-
'IE 11',
37-
)
38-
})
39-
40-
cy.startAppServer('component')
41-
cy.visitApp()
42-
cy.specsPageIsVisible()
25+
it('should initialize with unsupported browserslist entries', () => {
26+
// Create .browerslistrc that requests support for ES5
27+
// Support was dropped in Angular CLI v15 so this should generate a warning message in that version and beyond
28+
cy.withCtx(async (ctx) => {
29+
await ctx.actions.file.writeFileInProject(
30+
ctx.path.resolve('.browserslistrc'),
31+
'IE 11',
32+
)
4333
})
44-
}
34+
35+
cy.startAppServer('component')
36+
cy.visitApp()
37+
cy.specsPageIsVisible()
38+
})
4539
})
4640

4741
describe('test behaviors', () => {

0 commit comments

Comments
 (0)