fix: only mock the cpus() function on the os module instead of the whole module

This commit is contained in:
Daniel Kennedy
2025-10-15 16:26:39 +01:00
committed by Salman Muin Kayser Chishti
parent ee5d8970ad
commit 9b4ee219ef
+8 -4
View File
@@ -1,10 +1,14 @@
import * as config from '../src/internal/shared/config' import * as config from '../src/internal/shared/config'
import os from 'os' import os from 'os'
// Mock the 'os' module // Mock the `cpus()` function in the `os` module
jest.mock('os', () => ({ jest.mock('os', () => {
cpus: jest.fn() const osActual = jest.requireActual('os')
})) return {
...osActual,
cpus: jest.fn()
}
})
beforeEach(() => { beforeEach(() => {
jest.resetModules() jest.resetModules()