mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Use node protocol when importing builtins
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import cluster from 'cluster';
|
||||
import EventEmitter from 'events';
|
||||
import { cpus } from 'os';
|
||||
import cluster from 'node:cluster';
|
||||
import EventEmitter from 'node:events';
|
||||
import { cpus } from 'node:os';
|
||||
import { ClusterManager } from '../../../../src';
|
||||
import * as LogUtil from '../../../../src/logging/LogUtil';
|
||||
|
||||
jest.mock('cluster');
|
||||
jest.mock('os', (): any => ({
|
||||
...jest.requireActual('os'),
|
||||
jest.mock('node:cluster');
|
||||
jest.mock('node:os', (): any => ({
|
||||
...jest.requireActual('node:os'),
|
||||
cpus: jest.fn().mockImplementation((): any => [{}, {}, {}, {}, {}, {}]),
|
||||
}));
|
||||
|
||||
@@ -15,7 +15,7 @@ mockWorker.process = { pid: 666 };
|
||||
|
||||
describe('A ClusterManager', (): void => {
|
||||
const emitter = new EventEmitter();
|
||||
const mockCluster = jest.requireMock('cluster');
|
||||
const mockCluster = jest.requireMock('node:cluster');
|
||||
const mockLogger = { info: jest.fn(), warn: jest.fn() };
|
||||
jest.spyOn(LogUtil, 'getLoggerFor').mockImplementation((): any => mockLogger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user