fix: 清理后台开发态 React 警告

This commit is contained in:
que01 committed 2026-10-23 14:25:56 +08:00
1 parent 3af5611da5
commit 34504c0b44
8 files changed
+42 -9

No files matched your search

@@ -88,6 +88,25 @@ async function verifyCanvasTargets(page: Page, manifest: any, pageKey: string) {
}
const adminOrigin = process.env.ADMIN_URL || "http://localhost:3005";
const consoleWarnings = new WeakMap<Page, string[]>();
test.beforeEach(({ page }) => {
const warnings: string[] = [];
consoleWarnings.set(page, warnings);
page.on("console", (message) => {
const text = message.text();
const isWarning =
message.type() === "warning" ||
(message.type() === "error" &&
(text.startsWith("Warning:") || text.includes("non-boolean attribute")));
if (isWarning) warnings.push(text);
});
});
test.afterEach(({ page }) => {
expect(consoleWarnings.get(page) ?? []).toEqual([]);
});
const brand = {
id: "brand-fixture",
slug: "preview-fixture",