Skip to content

Commit e64071b

Browse files
committed
fix: tests
1 parent 6046dcb commit e64071b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

packages/core/src/test/shared/utilities/processUtils.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ describe('ChildProcessTracker', function () {
494494

495495
it('does not log for processes within threshold', async function () {
496496
const runningProcess = startSleepProcess()
497+
tracker.add(runningProcess.childProcess)
497498

498499
usageMock.returns({
499500
cpu: defaultProcessWarnThresholds.cpu - 1,
@@ -508,22 +509,32 @@ describe('ChildProcessTracker', function () {
508509
})
509510

510511
it('respects custom thresholds', async function () {
511-
const runningProcess = startSleepProcess({
512+
const largeRunningProcess = startSleepProcess({
512513
warnThresholds: {
513514
cpu: defaultProcessWarnThresholds.cpu + 10,
514515
memory: defaultProcessWarnThresholds.memory + 10,
515516
},
516517
})
518+
tracker.add(largeRunningProcess.childProcess)
519+
const smallRunningProcess = startSleepProcess({
520+
warnThresholds: {
521+
cpu: defaultProcessWarnThresholds.cpu - 10,
522+
memory: defaultProcessWarnThresholds.memory - 10,
523+
},
524+
})
525+
tracker.add(smallRunningProcess.childProcess)
517526

518527
usageMock.returns({
519528
cpu: defaultProcessWarnThresholds.cpu + 5,
520529
memory: defaultProcessWarnThresholds.memory + 5,
521530
})
522531

523532
await clock.tickAsync(ChildProcessTracker.pollingInterval)
524-
assert.throws(() => assertLogsContain(runningProcess.childProcess.pid().toString(), false, 'warn'))
533+
assert.throws(() => assertLogsContain(largeRunningProcess.childProcess.pid().toString(), false, 'warn'))
534+
assertLogsContain(smallRunningProcess.childProcess.pid().toString(), false, 'warn')
525535

526-
await stopAndWait(runningProcess)
536+
await stopAndWait(largeRunningProcess)
537+
await stopAndWait(smallRunningProcess)
527538
})
528539

529540
it('fills custom thresholds with default', async function () {
@@ -532,6 +543,7 @@ describe('ChildProcessTracker', function () {
532543
cpu: defaultProcessWarnThresholds.cpu + 10,
533544
},
534545
})
546+
tracker.add(runningProcess.childProcess)
535547

536548
usageMock.returns({
537549
memory: defaultProcessWarnThresholds.memory + 1,

0 commit comments

Comments
 (0)