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

This commit is contained in:
Daniel Kennedy
2025-09-24 20:01:53 -04: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 os from 'os'
// Mock the 'os' module
jest.mock('os', () => ({
cpus: jest.fn()
}))
// Mock the `cpus()` function in the `os` module
jest.mock('os', () => {
const osActual = jest.requireActual('os')
return {
...osActual,
cpus: jest.fn()
}
})
beforeEach(() => {
jest.resetModules()