27 lines
599 B
TypeScript
27 lines
599 B
TypeScript
import { vi } from "vitest";
|
|
|
|
const shouldLogErrors = process.env["SHOULD_LOG_ERRORS"] === "true";
|
|
|
|
if (!shouldLogErrors) {
|
|
const originalConsoleError = console.error;
|
|
console.error = (...args) => {
|
|
// Suppress specific error messages
|
|
if (
|
|
args[0]?.includes?.("Error: No email provided") ||
|
|
args[0]?.includes?.('TypeError: "pkcs8" must be PKCS#8 formatted string')
|
|
) {
|
|
return;
|
|
}
|
|
originalConsoleError(...args);
|
|
};
|
|
}
|
|
|
|
global.fetch = vi.fn();
|
|
|
|
vi.mock("cloudflare:workers", () => {
|
|
return {
|
|
env: {},
|
|
DurableObject: class DurableObject {},
|
|
};
|
|
});
|