fix: only mock the cpus() function on the os module instead of the whole module
This commit is contained in:
committed by
Salman Muin Kayser Chishti
parent
ee5d8970ad
commit
9b4ee219ef
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user