e115934061
Publish `@librechat/data-schemas` to NPM / pack (push) Failing after 8s
Publish `@librechat/client` to NPM / pack (push) Failing after 0s
GitNexus Index / index (push) Failing after 1s
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been skipped
Sync Helm Chart Tags / Sync chart tags (push) Failing after 2s
Publish `librechat-data-provider` to NPM / pack (push) Failing after 1s
Docker Dev Images Build / build (Dockerfile, librechat-dev, node) (push) Failing after 1s
Docker Dev Images Build / build (Dockerfile.multi, librechat-dev-api, api-build) (push) Failing after 0s
Sync Helm Chart Tags / Ignore non-main push (push) Has been skipped
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Failing after 1s
Publish `@librechat/client` to NPM / publish-npm (push) Has been cancelled
Publish `librechat-data-provider` to NPM / publish-npm (push) Has been cancelled
GitNexus Index / post-index (push) Has been cancelled
Publish `@librechat/data-schemas` to NPM / publish-npm (push) Has been cancelled
61 lines
1.8 KiB
JavaScript
61 lines
1.8 KiB
JavaScript
jest.mock('winston', () => {
|
|
// Real `winston.format(fn)` returns a Format constructor whose instances
|
|
// expose a `.transform(info, opts)` method that winston's pipeline calls.
|
|
// The previous mock `(fn) => fn` collapsed this — `parsers.redactFormat()`
|
|
// (called at @librechat/data-schemas dist module-load) ended up invoking
|
|
// the inner transform fn with no `info` argument, throwing on `info.level`.
|
|
// Returning a thunk that yields `{ transform: fn }` matches real winston's
|
|
// shape just enough that module-load completes cleanly; the inner fn is
|
|
// only ever invoked by winston's pipeline (never at load time).
|
|
const mockFormatFunction = jest.fn((fn) => () => ({ transform: fn }));
|
|
|
|
mockFormatFunction.colorize = jest.fn();
|
|
mockFormatFunction.combine = jest.fn();
|
|
mockFormatFunction.label = jest.fn();
|
|
mockFormatFunction.timestamp = jest.fn();
|
|
mockFormatFunction.printf = jest.fn();
|
|
mockFormatFunction.errors = jest.fn();
|
|
mockFormatFunction.splat = jest.fn();
|
|
mockFormatFunction.json = jest.fn();
|
|
return {
|
|
format: mockFormatFunction,
|
|
createLogger: jest.fn().mockReturnValue({
|
|
info: jest.fn(),
|
|
warn: jest.fn(),
|
|
debug: jest.fn(),
|
|
error: jest.fn(),
|
|
}),
|
|
transports: {
|
|
Console: jest.fn(),
|
|
DailyRotateFile: jest.fn(),
|
|
File: jest.fn(),
|
|
},
|
|
addColors: jest.fn(),
|
|
};
|
|
});
|
|
|
|
jest.mock('winston-daily-rotate-file', () => {
|
|
return jest.fn().mockImplementation(() => {
|
|
return {
|
|
level: 'error',
|
|
filename: '../logs/error-%DATE%.log',
|
|
datePattern: 'YYYY-MM-DD',
|
|
zippedArchive: true,
|
|
maxSize: '20m',
|
|
maxFiles: '14d',
|
|
format: 'format',
|
|
};
|
|
});
|
|
});
|
|
|
|
jest.mock('~/config', () => {
|
|
return {
|
|
logger: {
|
|
info: jest.fn(),
|
|
warn: jest.fn(),
|
|
debug: jest.fn(),
|
|
error: jest.fn(),
|
|
},
|
|
};
|
|
});
|