rwsdk
Version:
Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime
68 lines (67 loc) • 2.5 kB
JavaScript
// Module-level state to track resources and teardown status
export const state = {
isTearingDown: false,
exitCode: 0,
resources: {
tempDirCleanup: undefined,
workerName: undefined,
originalCwd: process.cwd(),
targetDir: undefined,
workerCreatedDuringTest: false,
stopDev: undefined,
},
options: {},
// Add a new failures array to track all failures
failures: [],
// Track whether tests have actually run
devTestsRan: false,
releaseTestsRan: false,
// New detailed test status tracking
testStatus: {
dev: {
overall: "DID_NOT_RUN",
initialServerSide: "DID_NOT_RUN",
initialClientSide: "DID_NOT_RUN",
initialServerRenderCheck: "DID_NOT_RUN",
realtimeUpgrade: "DID_NOT_RUN",
realtimeServerSide: "DID_NOT_RUN",
realtimeClientSide: "DID_NOT_RUN",
realtimeServerRenderCheck: "DID_NOT_RUN",
// HMR test statuses
initialServerHmr: "DID_NOT_RUN",
initialClientHmr: "DID_NOT_RUN",
realtimeServerHmr: "DID_NOT_RUN",
realtimeClientHmr: "DID_NOT_RUN",
// Style check statuses
initialUrlStyles: "DID_NOT_RUN",
initialClientModuleStyles: "DID_NOT_RUN",
realtimeUrlStyles: "DID_NOT_RUN",
realtimeClientModuleStyles: "DID_NOT_RUN",
},
production: {
overall: "DID_NOT_RUN",
releaseCommand: "DID_NOT_RUN",
initialServerSide: "DID_NOT_RUN",
initialClientSide: "DID_NOT_RUN",
initialServerRenderCheck: "DID_NOT_RUN",
realtimeUpgrade: "DID_NOT_RUN",
realtimeServerSide: "DID_NOT_RUN",
realtimeClientSide: "DID_NOT_RUN",
realtimeServerRenderCheck: "DID_NOT_RUN",
// HMR test statuses
initialServerHmr: "DID_NOT_RUN",
initialClientHmr: "DID_NOT_RUN",
realtimeServerHmr: "DID_NOT_RUN",
realtimeClientHmr: "DID_NOT_RUN",
// Style check statuses
initialUrlStyles: "DID_NOT_RUN",
initialClientModuleStyles: "DID_NOT_RUN",
realtimeUrlStyles: "DID_NOT_RUN",
realtimeClientModuleStyles: "DID_NOT_RUN",
},
},
};
// Helper function to update test status
export function updateTestStatus(env, test, status) {
state.testStatus[env][test] = status;
}