-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support Angular 19 with Cypress Component Testing #30675
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Bump this version to force CI to re-create the cache from scratch. | ||
|
||
11-21-24 | ||
11-26-24 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,7 +219,9 @@ function initTestBed<T> ( | |
return componentFixture | ||
} | ||
|
||
@Component({ selector: 'cy-wrapper-component', template: '' }) | ||
// if using the Wrapper Component (template strings), the component itself cannot be | ||
// a standalone component | ||
@Component({ selector: 'cy-wrapper-component', template: '', standalone: false }) | ||
class WrapperComponent { } | ||
|
||
/** | ||
|
@@ -260,6 +262,11 @@ function setupFixture<T> ( | |
|
||
fixture.whenStable().then(() => { | ||
fixture.autoDetectChanges(config.autoDetectChanges ?? true) | ||
}).catch((e) => { | ||
// If this promise does not settle in Angular 19 it is rejected | ||
// https://github.com/angular/angular/blob/main/CHANGELOG.md#1900-2024-11-19 | ||
// eslint-disable-next-line no-console | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
we likely don't want to propagate this failure up and fail, just log it to the console. some users trigger stability manually for some difference use cases (see #30327) |
||
console.error(e) | ||
}) | ||
|
||
return fixture | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ const runCommandInProject = (command: string, projectPath: string) => { | |
|
||
const cypressSchematicPackagePath = path.join(__dirname, '..') | ||
|
||
const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-17', 'angular-18'] | ||
const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-18', 'angular-19'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dropped 17 here for the schematic testing since it is time consuming and the schematic in 18 follows almost an identical pattern of that in 17 |
||
|
||
describe('ng add @cypress/schematic / only e2e', { timeout: 1000 * 60 * 5 }, function () { | ||
for (const project of ANGULAR_PROJECTS) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved from |
||
"cli": { | ||
"analytics": false | ||
}, | ||
"version": 1, | ||
"newProjectRoot": "projects", | ||
"projects": { | ||
"angular": { | ||
"projectType": "application", | ||
"schematics": { | ||
"@schematics/angular:component": { | ||
"style": "scss" | ||
}, | ||
"@schematics/angular:application": { | ||
"strict": true | ||
} | ||
}, | ||
"root": "", | ||
"sourceRoot": "src", | ||
"prefix": "app", | ||
"architect": { | ||
"build": { | ||
"builder": "@angular-devkit/build-angular:browser", | ||
"options": { | ||
"outputPath": "dist/angular", | ||
"index": "src/index.html", | ||
"main": "src/main.ts", | ||
"polyfills": "src/polyfills.ts", | ||
"tsConfig": "tsconfig.app.json", | ||
"inlineStyleLanguage": "scss", | ||
"assets": [ | ||
"src/favicon.ico", | ||
"src/assets" | ||
], | ||
"styles": [ | ||
"src/styles.scss" | ||
], | ||
"scripts": [] | ||
}, | ||
"configurations": { | ||
"production": { | ||
"budgets": [ | ||
{ | ||
"type": "initial", | ||
"maximumWarning": "500kb", | ||
"maximumError": "1mb" | ||
}, | ||
{ | ||
"type": "anyComponentStyle", | ||
"maximumWarning": "2kb", | ||
"maximumError": "4kb" | ||
} | ||
], | ||
"fileReplacements": [ | ||
{ | ||
"replace": "src/environments/environment.ts", | ||
"with": "src/environments/environment.prod.ts" | ||
} | ||
], | ||
"outputHashing": "all" | ||
}, | ||
"development": { | ||
"buildOptimizer": false, | ||
"optimization": false, | ||
"vendorChunk": true, | ||
"extractLicenses": false, | ||
"sourceMap": true, | ||
"namedChunks": true | ||
} | ||
}, | ||
"defaultConfiguration": "production" | ||
}, | ||
"serve": { | ||
"builder": "@angular-devkit/build-angular:dev-server", | ||
"configurations": { | ||
"production": { | ||
"browserTarget": "angular:build:production" | ||
}, | ||
"development": { | ||
"browserTarget": "angular:build:development" | ||
} | ||
}, | ||
"defaultConfiguration": "development" | ||
}, | ||
"extract-i18n": { | ||
"builder": "@angular-devkit/build-angular:extract-i18n", | ||
"options": { | ||
"browserTarget": "angular:build" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "angular" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since template strings require a references to the actual component in the test module, the component cannot be a standalone component