





























@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
22import fs from "node:fs";
33import os from "node:os";
44import path from "node:path";
5-import { describe, expect, it } from "vitest";
5+import { describe, expect, it, vi } from "vitest";
66import {
77BUILD_ALL_PROFILES,
88BUILD_ALL_PROFILE_STEP_ENV,
@@ -12,6 +12,7 @@ import {
1212formatBuildAllTimingSummary,
1313parseBuildAllArgs,
1414resolveBuildAllStepCacheState,
15+resolveBuildAllStepCacheStampState,
1516resolveBuildAllStep,
1617resolveBuildAllSteps,
1718restoreBuildAllStepCacheOutputs,
@@ -531,6 +532,24 @@ describe("resolveBuildAllStepCacheState", () => {
531532});
532533});
533534535+it("reuses the pre-run input signature when stamping successful cacheable steps", () => {
536+withBuildCacheFixture(({ rootDir, step }) => {
537+const cacheState = resolveBuildAllStepCacheState(step, { rootDir });
538+const readSpy = vi.spyOn(fs, "readFileSync");
539+540+try {
541+const stampState = resolveBuildAllStepCacheStampState(step, cacheState, { rootDir });
542+writeBuildAllStepCacheStamp(step, stampState, { rootDir });
543+544+expect(readSpy).not.toHaveBeenCalled();
545+expect(stampState.signature).toBe(cacheState.signature);
546+expect(stampState.relativeOutputFiles).toEqual(["dist/output.js"]);
547+} finally {
548+readSpy.mockRestore();
549+}
550+});
551+});
552+534553it("marks cacheable steps stale when a tracked env input changes", () => {
535554withBuildCacheFixture(({ rootDir, step }) => {
536555const envStep = {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。