




















@@ -1,6 +1,10 @@
11import { describe, expect, it, vi } from "vitest";
22import { noteStartupOptimizationHints } from "./doctor-platform-notes.js";
334+function firstNoteCall(noteFn: ReturnType<typeof vi.fn>) {
5+return noteFn.mock.calls[0] ?? [];
6+}
7+48describe("noteStartupOptimizationHints", () => {
59it("does not warn when compile cache and no-respawn are configured", () => {
610const noteFn = vi.fn();
@@ -27,7 +31,7 @@ describe("noteStartupOptimizationHints", () => {
2731);
28322933expect(noteFn).toHaveBeenCalledTimes(1);
30-const [message, title] = noteFn.mock.calls.at(0) ?? [];
34+const [message, title] = firstNoteCall(noteFn);
3135expect(title).toBe("Startup optimization");
3236expect(message).toBe(
3337[
@@ -54,7 +58,7 @@ describe("noteStartupOptimizationHints", () => {
5458);
55595660expect(noteFn).toHaveBeenCalledTimes(1);
57-const [message] = noteFn.mock.calls.at(0) ?? [];
61+const [message] = firstNoteCall(noteFn);
5862expect(message).toBe(
5963[
6064"- NODE_DISABLE_COMPILE_CACHE is set; startup compile cache is disabled.",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。