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 issue with jasmine.clock() with "builderMode: application" #28813

Open
1 task
cexbrayat opened this issue Nov 7, 2024 · 0 comments
Open
1 task
Assignees
Labels

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

When using jasmine.clock(), tests are throwing with the application builder

Minimal Reproduction

Generate a new project with npx @angular/[email protected] new karma-clock --defaults --no-routing
Update the test app.component.spec.ts with:

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      imports: [AppComponent],
    }).compileComponents();
    jasmine.clock().install();
  });

  afterEach(() => jasmine.clock().uninstall());

Run the test: everything is fine.

Add "builderMode": "application", to angular.json in the karma options.
Run ng test again, the tests fail

Exception or Error

07 11 2024 18:11:04.827:INFO [Chrome 130.0.0.0 (Mac OS 10.15.7)]: Connected on socket cJzDaksNAB24vLcmAAAB with id 93837966
Chrome 130.0.0.0 (Mac OS 10.15.7) AppComponent should render title FAILED
Error: Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?

Your Environment

Angular CLI: 19.0.0-rc.1
Node: 20.13.1
Package Manager: npm 9.7.1
OS: darwin arm64

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

Package Version

@angular-devkit/architect 0.1900.0-rc.1
@angular-devkit/build-angular 19.0.0-rc.1
@angular-devkit/core 19.0.0-rc.1
@angular-devkit/schematics 19.0.0-rc.1
@schematics/angular 19.0.0-rc.1
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0

Anything else relevant?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants