Skip to content
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/build as an optional replacement for @angular-devkit/build-angular in Angular 19 Component Testing #30903

Open
jcompagner opened this issue Jan 17, 2025 · 1 comment
Labels
CT Issue related to component testing npm: @cypress/angular @cypress/angular package issues type: feature New feature that does not currently exist v14.0.0 🐛 Issue present since 14.0.0

Comments

@jcompagner
Copy link

jcompagner commented Jan 17, 2025

Current behavior

Angular 19 doesn't use devkit (webpack) anymore by default. In Cypress 14 I get this error:

Error: Could not resolve "@angular-devkit/build-angular/src/utils/webpack-browser-config.js". Do you have "@angular-devkit/build-angular" and "@angular-devkit/core" installed?
    at C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:106:19
    at Array.map (<anonymous>)
    at getAngularCliModules (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:100:151)
    at async getAngularCliWebpackConfig (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:159:101)
    at async angularHandler (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\helpers\angularHandler.js:205:27)
    at async getPreset (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:62:20)
    at async Function.devServer.create (C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:79:61)
    at async C:\Users\jcomp\AppData\Local\Cypress\Cache\14.0.0\Cypress\resources\app\node_modules\@packages\server\node_modules\@cypress\webpack-dev-server\dist\devServer.js:22:24

because we don't use the webpack builder anymore, we use purely the @angular/build:application builder.

Also the schematics of the angular upgrade from 18 to 19 will remove the npm package: "@angular-devkit/build-angular" and adds the package:
"@angular/build"

Is cypress able to run with the new builder and not webpack?

Desired behavior

cypress should run with the new application builder (esbuild) instead of webpack which is not used anymore by angular itself

Test code to reproduce

here is our component test:
https://github.com/Servoy/servoy-extra-components

here is the angular.json that has the applicaiton builder (of the dummy project used by cypress)

https://github.com/Servoy/servoy-extra-components/blob/master/angular.json#L37

Cypress Version

14

Node version

v22.11.0

Operating System

windows 11

Debug Logs

Other

No response

@jennifer-shehane jennifer-shehane added CT Issue related to component testing npm: @cypress/angular @cypress/angular package issues v14.0.0 🐛 Issue present since 14.0.0 labels Jan 17, 2025
@AtofStryker
Copy link
Contributor

Hi @jcompagner. Thank you for opening an issue. Unfortunately right now Cypress is still dependent on the @angular-devkit/build-angular package. I believe this is still the default since @angular-devkit/build-angular is scaffolded when invoking an ng new project with the CLI.

I am going to mark this issue as a feature request to support the newer esbuild @angular/build package.

@AtofStryker AtofStryker added the type: feature New feature that does not currently exist label Jan 17, 2025
@AtofStryker AtofStryker changed the title Angular 19 doesn't use devkit (webpack) anymore by default feat: support @angular/build as an optional replacement for @angular-devkit/build-angular in Angular 19 Component Testing Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CT Issue related to component testing npm: @cypress/angular @cypress/angular package issues type: feature New feature that does not currently exist v14.0.0 🐛 Issue present since 14.0.0
Projects
None yet
Development

No branches or pull requests

3 participants