test: migrate from bun to pnpm and vitest
This commit is contained in:
27
testSetup.ts
27
testSetup.ts
@@ -1,3 +1,26 @@
|
||||
if (process.env.SHOULD_LOG_ERRORS === "false") {
|
||||
console.error = () => {};
|
||||
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 {},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user