Files
pnpm/packages/plugin-commands-doctor/test/index.ts
2025-08-19 00:16:25 +02:00

24 lines
591 B
TypeScript

import { doctor } from '@pnpm/plugin-commands-doctor'
import { logger } from '@pnpm/logger'
import { jest } from '@jest/globals'
beforeEach(() => {
jest.spyOn(logger, 'warn')
})
afterEach(() => {
jest.mocked(logger.warn).mockRestore()
})
test('doctor', async () => {
// In the scope of jest, require.resolve.paths('npm') cannot reach global npm path by default
await doctor.handler({
failedToLoadBuiltInConfig: true,
})
expect(logger.warn).toHaveBeenCalledWith({
message: expect.stringMatching(/^Load npm builtin configs failed./),
prefix: process.cwd(),
})
})