@ripplo/testing 0.0.4 → 0.0.5

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.
package/dist/index.js CHANGED
@@ -61,7 +61,11 @@ function createRipplo(rawConfig) {
61
61
  },
62
62
  precondition(name) {
63
63
  if (preconditionNames.has(name)) {
64
- throw new Error(`Duplicate precondition name: "${name}"`);
64
+ preconditions.splice(
65
+ 0,
66
+ preconditions.length,
67
+ ...preconditions.filter((p) => p.name !== name)
68
+ );
65
69
  }
66
70
  preconditionNames.add(name);
67
71
  return buildPrecondition(name, preconditions);
@@ -69,7 +73,7 @@ function createRipplo(rawConfig) {
69
73
  test(id) {
70
74
  validateTestId(id);
71
75
  if (testNames.has(id)) {
72
- throw new Error(`Duplicate test id: "${id}"`);
76
+ tests.splice(0, tests.length, ...tests.filter((t) => t.id !== id));
73
77
  }
74
78
  testNames.add(id);
75
79
  return buildTestName(id, tests);
package/dist/nextjs.js CHANGED
@@ -23,10 +23,9 @@ function createNextHandler({ enabled, ripplo }) {
23
23
  if ("error" in verified) {
24
24
  return verified.error;
25
25
  }
26
- if (action === "execute-batch") {
27
- return handleExecuteBatch({ body: verified.body, engine, req });
28
- }
29
- return handleTeardown({ body: verified.body, engine });
26
+ return runGuarded(
27
+ () => action === "execute-batch" ? handleExecuteBatch({ body: verified.body, engine, req }) : handleTeardown({ body: verified.body, engine })
28
+ );
30
29
  };
31
30
  }
32
31
  async function handleExecuteBatch({
@@ -85,6 +84,20 @@ async function verifyAndReadBody(req, webhookSecret) {
85
84
  }
86
85
  return { body };
87
86
  }
87
+ async function runGuarded(fn) {
88
+ try {
89
+ return await fn();
90
+ } catch (error) {
91
+ return jsonResponse(
92
+ {
93
+ error: error instanceof Error ? error.message : "Unknown error",
94
+ stack: error instanceof Error ? error.stack : void 0,
95
+ success: false
96
+ },
97
+ 500
98
+ );
99
+ }
100
+ }
88
101
  function lastPathSegment(url) {
89
102
  const pathname = new URL(url).pathname;
90
103
  const segments = pathname.split("/").filter((s) => s.length > 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ripplo/testing",
3
3
  "description": "TypeScript DSL for defining and running Ripplo e2e workflow tests",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -55,19 +55,19 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "standardwebhooks": "^1.0.0",
58
- "zod": "^4.3.6"
58
+ "zod": "catalog:"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/express": "^5.0.2",
62
- "@types/node": "^22.15.3",
63
- "eslint": "^9.39.1",
62
+ "@types/node": "catalog:",
63
+ "eslint": "catalog:",
64
64
  "express": "^5.1.0",
65
65
  "fastify": "^5.3.3",
66
66
  "tsup": "^8.5.1",
67
- "typescript": "^5.9.3",
67
+ "typescript": "catalog:",
68
68
  "vitest": "^4.1.4",
69
- "@ripplo/spec": "^0.0.0",
70
- "@ripplo/eslint-config": "0.0.0"
69
+ "@ripplo/eslint-config": "0.0.0",
70
+ "@ripplo/spec": "^0.0.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "dotenv": "^16.0.0 || ^17.0.0",