Skip to content

Commit 3449e48

Browse files
fix failing tests
Signed-off-by: nkomonen-amazon <[email protected]>
1 parent 545508a commit 3449e48

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

packages/core/src/shared/crashMonitoring.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ class Heartbeat {
205205
await this.state.clearHeartbeat()
206206
} catch {}
207207
}
208+
209+
/** Mimics a crash, only for testing */
210+
public testCrash() {
211+
globals.clock.clearInterval(this.intervalRef)
212+
}
208213
}
209214

210215
/**
@@ -312,10 +317,15 @@ class CrashChecker {
312317
}
313318
}
314319

315-
/** Use this on failures */
320+
/** Use this on failures to terminate the crash checker */
316321
public cleanup() {
317322
globals.clock.clearInterval(this.intervalRef)
318323
}
324+
325+
/** Mimics a crash, only for testing */
326+
public testCrash() {
327+
globals.clock.clearInterval(this.intervalRef)
328+
}
319329
}
320330

321331
/**

packages/core/src/test/shared/crashMonitoring.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class TestCrashMonitoring extends CrashMonitoring {
1414
public constructor(...deps: ConstructorParameters<typeof CrashMonitoring>) {
1515
super(...deps)
1616
}
17-
/** Immitates an extension crash */
17+
/** Imitates an extension crash */
1818
public async crash() {
19-
this.crashChecker?.cleanup()
20-
await this.heartbeat?.cleanup()
19+
this.crashChecker?.testCrash()
20+
this.heartbeat?.testCrash()
2121
}
2222
}
2323

0 commit comments

Comments
 (0)