



















@@ -404,7 +404,7 @@ describe("loadPluginMetadataSnapshot process memo", () => {
404404expect(readSpy).not.toHaveBeenCalled();
405405});
406406407-it("does not memoize policy-stale derived snapshots", () => {
407+it("memoizes policy-stale derived snapshots within the process", () => {
408408const stateDir = tempStateDir();
409409touchPersistedIndex(stateDir);
410410loadPluginRegistrySnapshotWithMetadata.mockReturnValue({
@@ -422,10 +422,10 @@ describe("loadPluginMetadataSnapshot process memo", () => {
422422loadPluginMetadataSnapshot({ config: {}, env: {}, stateDir });
423423loadPluginMetadataSnapshot({ config: {}, env: {}, stateDir });
424424425-expect(loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledTimes(2);
425+expect(loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledOnce();
426426});
427427428-it("refreshes policy-stale derived snapshots when derived plugin files change", () => {
428+it("keeps process-stable derived snapshots when derived plugin files change", () => {
429429const stateDir = tempStateDir();
430430touchPersistedIndex(stateDir);
431431const pluginDir = path.join(stateDir, "current", "derived");
@@ -448,16 +448,16 @@ describe("loadPluginMetadataSnapshot process memo", () => {
448448writeJson(manifestPath, { id: "derived", version: "2.0.0", commandAliases: [{ name: "new" }] });
449449loadPluginMetadataSnapshot({ config: {}, env: {}, stateDir });
450450451-expect(loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledTimes(2);
452-expect(loadPluginManifestRegistryForInstalledIndex).toHaveBeenCalledTimes(2);
451+expect(loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledOnce();
452+expect(loadPluginManifestRegistryForInstalledIndex).toHaveBeenCalledOnce();
453453});
454454455455it.each([
456456["persisted-registry-missing", undefined],
457457["persisted-registry-stale-source", undefined],
458458["persisted-registry-disabled", undefined],
459459[undefined, { preferPersisted: false }],
460-])("does not memoize derived snapshots for %s diagnostics", (code, options) => {
460+])("memoizes derived snapshots for %s diagnostics within the process", (code, options) => {
461461const stateDir = tempStateDir();
462462touchPersistedIndex(stateDir);
463463loadPluginRegistrySnapshotWithMetadata.mockReturnValue({
@@ -469,7 +469,7 @@ describe("loadPluginMetadataSnapshot process memo", () => {
469469loadPluginMetadataSnapshot({ config: {}, env: {}, stateDir, ...options });
470470loadPluginMetadataSnapshot({ config: {}, env: {}, stateDir, ...options });
471471472-expect(loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledTimes(2);
472+expect(loadPluginRegistrySnapshotWithMetadata).toHaveBeenCalledOnce();
473473});
474474475475it("refreshes when the persisted registry file changes", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。