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

Karma builder doesn't watch files with "builderMode: application" #28730

Closed
1 task
cexbrayat opened this issue Oct 28, 2024 · 4 comments · Fixed by #28739
Closed
1 task

Karma builder doesn't watch files with "builderMode: application" #28730

cexbrayat opened this issue Oct 28, 2024 · 4 comments · Fixed by #28739

Comments

@cexbrayat
Copy link
Member

Command

test

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Using the "builderMode": "application", option in the Karam builder breaks ng test watch capabilities

Minimal Reproduction

Create a new project with npx @angular/cli@19.0.0-next.13 new karma-watch --defaults --no-routing
Add "builderMode": "application", to angular.json in the karmaoptions.
Launch ng test
Update any file of the project like app.component.ts or app.component.spec.ts: the tests don't run again.

Exception or Error

No response

Your Environment

Angular CLI: 19.0.0-next.13
Node: 20.13.1
Package Manager: npm 9.7.1
OS: darwin arm64

Angular: 19.0.0-next.11
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1900.0-next.13
@angular-devkit/build-angular 19.0.0-next.13
@angular-devkit/core 19.0.0-next.13
@angular-devkit/schematics 19.0.0-next.13
@angular/cli 19.0.0-next.13
@schematics/angular 19.0.0-next.13
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0

Anything else relevant?

No response

@jkrems
Copy link
Contributor

jkrems commented Oct 29, 2024

I can repro:

-- Watches for changes:
$ ng test --builder-mode=application --watch

-- Doesn't watch for changes (but keeps browser open):
$ ng test --builder-mode=application

-- Doesn't watch for changes, closes browser.
$ ng test --builder-mode=application --no-watch

-- Watches for changes:
$ ng test --builder-mode=browser
$ ng test --builder-mode=browser --watch

-- Doesn't watch for changes, closes browser.
$ ng test --builder-mode=browser --no-watch

So it looks like the --watch default behavior is different. Specifically for the implicit default when --watch isn't passed.

jkrems added a commit to jkrems/angular-cli that referenced this issue Oct 29, 2024
Outside of single-run mode, the karma test provider was expected to
watch for changes. In the application builder branch, we only handled
the case of an explicit `--watch` though. This meant that the karma
runner was kept running but didn't see any file changes.

Fixes angular#28730
@jkrems
Copy link
Contributor

jkrems commented Oct 29, 2024

Thanks for trying this out & the great bug details. Verified that the following fixes the bug: #28739

@jkrems jkrems closed this as completed in 8646751 Oct 29, 2024
jkrems added a commit that referenced this issue Oct 29, 2024
Outside of single-run mode, the karma test provider was expected to
watch for changes. In the application builder branch, we only handled
the case of an explicit `--watch` though. This meant that the karma
runner was kept running but didn't see any file changes.

Fixes #28730

(cherry picked from commit 8646751)
@jkrems
Copy link
Contributor

jkrems commented Oct 29, 2024

The fix should be included in this week's next release (e.g. ~tomorrow).

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants