UNPKG

@boost/log

Version:

Lightweight level based logging system.

32 lines (31 loc) 702 B
/** * Returns a Vitest spy that matches the return value shape of `createLogger`. * * ```ts * import { mockLogger } from '@boost/log/test'; * * it('calls the logger', async () => { * const log = await mockLogger(); * * log('Something has happened'); * * expect(log).toHaveBeenCalled(); * }); * ``` */ async function mockLogger() { const _await$import = await import('vitest'), vi = _await$import.vi; const log = vi.fn(); log.disable = vi.fn(); log.enable = vi.fn(); log.debug = vi.fn(); log.error = vi.fn(); log.log = vi.fn(); log.info = vi.fn(); log.trace = vi.fn(); log.warn = vi.fn(); return log; } export { mockLogger }; //# sourceMappingURL=test.mjs.map