rwsdk 1.0.0-alpha.20-test.20250929150529 → 1.0.0-alpha.20-test.20250929160709

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,12 @@ const DEV_SERVER_MIN_TRIES = process.env.RWSDK_DEV_SERVER_MIN_TRIES
36
36
  const SETUP_WAIT_TIMEOUT = process.env.RWSDK_SETUP_WAIT_TIMEOUT
37
37
  ? parseInt(process.env.RWSDK_SETUP_WAIT_TIMEOUT, 10)
38
38
  : 10 * 60 * 1000;
39
+ const TEST_MAX_RETRIES = process.env.RWSDK_TEST_MAX_RETRIES
40
+ ? parseInt(process.env.RWSDK_TEST_MAX_RETRIES, 10)
41
+ : 10;
42
+ const TEST_MAX_RETRIES_PER_CODE = process.env.RWSDK_TEST_MAX_RETRIES_PER_CODE
43
+ ? parseInt(process.env.RWSDK_TEST_MAX_RETRIES_PER_CODE, 10)
44
+ : 6;
39
45
  // Environment variable flags for skipping tests
40
46
  const SKIP_DEV_SERVER_TESTS = process.env.RWSDK_SKIP_DEV === "1";
41
47
  const SKIP_DEPLOYMENT_TESTS = process.env.RWSDK_SKIP_DEPLOY === "1";
@@ -258,10 +264,10 @@ export async function createDeployment(projectDir) {
258
264
  * called automatically on failure.
259
265
  */
260
266
  export async function runTestWithRetries(name, attemptFn) {
261
- const MAX_RETRIES_PER_CODE = 6;
262
267
  const retryCounts = {};
263
268
  let attempt = 0;
264
- while (true) {
269
+ let lastError;
270
+ while (attempt < TEST_MAX_RETRIES) {
265
271
  attempt++;
266
272
  try {
267
273
  await attemptFn();
@@ -271,26 +277,26 @@ export async function runTestWithRetries(name, attemptFn) {
271
277
  return; // Success
272
278
  }
273
279
  catch (e) {
280
+ lastError = e;
274
281
  const errorCode = e?.code;
275
282
  if (typeof errorCode === "string" && errorCode) {
276
283
  const count = (retryCounts[errorCode] || 0) + 1;
277
284
  retryCounts[errorCode] = count;
278
- if (count <= MAX_RETRIES_PER_CODE) {
279
- console.log(`[runTestWithRetries] Attempt ${attempt} for "${name}" failed with code ${errorCode}. Retrying (failure ${count}/${MAX_RETRIES_PER_CODE} for this code)...`);
280
- await new Promise((resolve) => setTimeout(resolve, 1000));
281
- continue; // Next attempt
282
- }
283
- else {
284
- console.error(`[runTestWithRetries] Test "${name}" failed with code ${errorCode} after ${MAX_RETRIES_PER_CODE} retries for this code.`);
285
- throw e; // Give up
285
+ if (count > TEST_MAX_RETRIES_PER_CODE) {
286
+ console.error(`[runTestWithRetries] Test "${name}" failed with code ${errorCode} after ${count - 1} retries. Max per-code retries (${TEST_MAX_RETRIES_PER_CODE}) exceeded.`);
287
+ throw e; // Give up for this specific error code
286
288
  }
287
289
  }
290
+ if (attempt < TEST_MAX_RETRIES) {
291
+ console.log(`[runTestWithRetries] Attempt ${attempt}/${TEST_MAX_RETRIES} for "${name}" failed. Retrying...`);
292
+ await new Promise((resolve) => setTimeout(resolve, 1000));
293
+ }
288
294
  else {
289
- console.error(`[runTestWithRetries] Test "${name}" failed on attempt ${attempt} with a non-retryable error:`, e);
290
- throw e;
295
+ console.error(`[runTestWithRetries] Test "${name}" failed after ${attempt} attempts.`);
291
296
  }
292
297
  }
293
298
  }
299
+ throw lastError;
294
300
  }
295
301
  function createTestRunner(testFn, envType) {
296
302
  return (name, testLogic) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rwsdk",
3
- "version": "1.0.0-alpha.20-test.20250929150529",
3
+ "version": "1.0.0-alpha.20-test.20250929160709",
4
4
  "description": "Build fast, server-driven webapps on Cloudflare with SSR, RSC, and realtime",
5
5
  "type": "module",
6
6
  "bin": {