




















@@ -1,7 +1,8 @@
11import { spawnSync } from "node:child_process";
22import fs from "node:fs";
33import path from "node:path";
4-import { describe, expect, it, vi } from "vitest";
4+import { describe, expect, it } from "vitest";
5+import { expectNoReaddirSyncDuring } from "../test-utils/fs-scan-assertions.js";
56import { collectBundledChannelConfigs } from "./bundled-channel-config-metadata.js";
67import {
78type BundledPluginMetadata,
@@ -132,11 +133,10 @@ function listRepoBundledPluginMetadata(): readonly BundledPluginMetadata[] {
132133133134function listRepoBundledPluginManifestsUncached() {
134135const bundledPluginsDir = path.join(repoRoot, "extensions");
135-return listRepoBundledPluginManifestDirs()
136-.flatMap((dirName) => {
137-const result = loadPluginManifest(path.join(bundledPluginsDir, dirName), false);
138-return result.ok ? [{ dirName, manifest: result.manifest }] : [];
139-});
136+return listRepoBundledPluginManifestDirs().flatMap((dirName) => {
137+const result = loadPluginManifest(path.join(bundledPluginsDir, dirName), false);
138+return result.ok ? [{ dirName, manifest: result.manifest }] : [];
139+});
140140}
141141142142function listRepoBundledPluginManifestDirs(): string[] {
@@ -335,16 +335,12 @@ function createInstalledPluginIndexForManifests(
335335336336describe("bundled plugin metadata", () => {
337337it("lists bundled plugin manifests without scanning extension directories in-process", () => {
338-const readDir = vi.spyOn(fs, "readdirSync");
339-try {
338+expectNoReaddirSyncDuring(() => {
340339const manifests = listRepoBundledPluginManifestsUncached();
341340342341expect(manifests.length).toBeGreaterThan(0);
343342expect(manifests.every((entry) => entry.dirName.length > 0)).toBe(true);
344-expect(readDir).not.toHaveBeenCalled();
345-} finally {
346-readDir.mockRestore();
347-}
343+});
348344});
349345350346it(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。