From 01789f540455d128c085f02acd8a942102096307 Mon Sep 17 00:00:00 2001 From: Nicolas Jourdain Date: Tue, 10 Feb 2026 10:54:28 -0500 Subject: [PATCH] Make performance.now behave more like real world --- projects/ng-dev/package.json | 2 +- projects/ng-dev/src/lib/angular-context/angular-context.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/ng-dev/package.json b/projects/ng-dev/package.json index 3d26876b..24821ef6 100644 --- a/projects/ng-dev/package.json +++ b/projects/ng-dev/package.json @@ -1,6 +1,6 @@ { "name": "@sama/ng-dev", - "version": "20.0.0", + "version": "20.0.1", "author": "Samasource", "license": "MIT", "homepage": "https://github.com/Samasource/s-libs/tree/master/projects/ng-dev", diff --git a/projects/ng-dev/src/lib/angular-context/angular-context.ts b/projects/ng-dev/src/lib/angular-context/angular-context.ts index c7408b72..299f1579 100644 --- a/projects/ng-dev/src/lib/angular-context/angular-context.ts +++ b/projects/ng-dev/src/lib/angular-context/angular-context.ts @@ -260,7 +260,9 @@ export class AngularContext { #runWithMockedTime(test: VoidFunction): void { // https://github.com/angular/angular/issues/31677#issuecomment-573139551 const { now } = performance; - spyOn(performance, 'now').and.callFake(() => Date.now()); + spyOn(performance, 'now').and.callFake( + () => Date.now() - this.startTime.getTime(), + ); jasmine.clock().install(); fakeAsync(() => {