@alexaegis/logging
Version:
Minimal logging tools
33 lines (32 loc) • 859 B
JavaScript
//#region src/mocks.ts
/**
* The vi object is passed because if there's a version mismatch in a pnpm
* workspace between this package and its consumer, a different vitest will
* initialize these mock functions and you wouldn't be able to reset/clear
* mocks
*
* It will return a logger wrapped in an object, under two keys:
* one with the mock type to let you use them as mocks, and one with the real
* Logger type so you can pass it around. Both are the same object instance.
*/
var createMockLogger = (vi) => {
const mockLogger = {
silly: vi.fn(),
trace: vi.fn(),
debug: vi.fn(),
log: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
fatal: vi.fn(),
error: vi.fn(),
attachTransport: vi.fn(),
getSubLogger: vi.fn()
};
return {
logger: mockLogger,
mockLogger
};
};
//#endregion
export { createMockLogger };
//# sourceMappingURL=mocks.js.map