@ripplo/testing 0.5.3 → 0.5.4
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/README.md +4 -2
- package/dist/{builder-DiVz3t1D.d.ts → builder-SsgqYqSC.d.ts} +1 -1
- package/dist/compiler.d.ts +1 -1
- package/dist/elysia.d.ts +2 -2
- package/dist/{engine-DVbF4E5A.d.ts → engine-BOqzK_go.d.ts} +3 -2
- package/dist/express.d.ts +2 -2
- package/dist/fastify.d.ts +2 -2
- package/dist/hono.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -2
- package/dist/koa.d.ts +2 -2
- package/dist/lockfile.d.ts +1 -1
- package/dist/nestjs.d.ts +2 -2
- package/dist/nextjs.d.ts +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -256,12 +256,14 @@ Each batched setup item exposes `ctx`:
|
|
|
256
256
|
|
|
257
257
|
- `ctx.runId` — 12-char run id.
|
|
258
258
|
- `ctx.fixed(value)` — static test value, type-branded so the engine can tell it apart from a raw literal.
|
|
259
|
-
- `ctx.uniqueId(prefix)` returns `ripplo-test-<prefix>-<runId
|
|
260
|
-
- `ctx.uniqueEmail()` returns `ripplo-test-<runId>@test.ripplo.ai
|
|
259
|
+
- `ctx.uniqueId(prefix)` returns `ripplo-test-<prefix>-<runId>-<n>`, where `n` is a per-call counter scoped to the run. Calling it repeatedly yields distinct values.
|
|
260
|
+
- `ctx.uniqueEmail()` returns `ripplo-test-<runId>-<n>@test.ripplo.ai`, same per-call counter.
|
|
261
261
|
- `ctx.setCookie(name, value, options?)` applies to that run's browser context before the test starts.
|
|
262
262
|
|
|
263
263
|
Helpers return plain primitives, but the return type is branded — a bare string literal in a `setup` return fails at compile time, which is what stops tests from accidentally seeding identical-looking data across runs.
|
|
264
264
|
|
|
265
|
+
The shared prefix (`ripplo-test-`) is also exported as `TEST_ID_PREFIX` from `@ripplo/testing`, so teardown / cleanup logic that scopes `WHERE` clauses by `startsWith(TEST_ID_PREFIX)` doesn't have to hardcode the string.
|
|
266
|
+
|
|
265
267
|
### Observer context
|
|
266
268
|
|
|
267
269
|
The observer impl returns one of three terminal states:
|
|
@@ -153,4 +153,4 @@ declare function test(id: string, options?: TestOptions): TestNeedsName;
|
|
|
153
153
|
*/
|
|
154
154
|
declare function createRipplo<P extends PreconditionRegistry, O extends ObserverRegistry>(registries: RipploRegistries<P, O>): RipploInstance<P, O>;
|
|
155
155
|
|
|
156
|
-
export { type CoverageRegistry as C, type ObserverImplFn as O, type PreconditionImpl as P, type ResolveDeps as R, type ObserverRegistry as a, type PreconditionRecord as b, type PreconditionRegistry as c, type
|
|
156
|
+
export { type CoverageRegistry as C, type ObserverImplFn as O, type PreconditionImpl as P, type ResolveDeps as R, type ObserverRegistry as a, type PreconditionRecord as b, type PreconditionRegistry as c, type PreconditionSetupItem as d, type PreconditionTeardownItem as e, type RipploBuilder as f, type RipploInstance as g, type RipploRegistries as h, createRipplo as i, observer as o, precondition as p, test as t };
|
package/dist/compiler.d.ts
CHANGED
package/dist/elysia.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Elysia } from 'elysia';
|
|
2
|
-
import { R as RipploEngine } from './engine-
|
|
3
|
-
import './builder-
|
|
2
|
+
import { R as RipploEngine } from './engine-BOqzK_go.js';
|
|
3
|
+
import './builder-SsgqYqSC.js';
|
|
4
4
|
import './types-BzZrl65Z.js';
|
|
5
5
|
import './step-De52hTLd.js';
|
|
6
6
|
import '@ripplo/spec';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { c as PreconditionRegistry, a as ObserverRegistry, O as ObserverImplFn, P as PreconditionImpl,
|
|
1
|
+
import { c as PreconditionRegistry, a as ObserverRegistry, O as ObserverImplFn, P as PreconditionImpl, g as RipploInstance } from './builder-SsgqYqSC.js';
|
|
2
2
|
import { P as Primitive, g as ObserverOutcome, C as CookieEntry, f as ObserverDefinition, l as PreconditionDefinition, U as UnimplementedItems, O as ObserverHandle, h as Precondition } from './types-BzZrl65Z.js';
|
|
3
3
|
|
|
4
|
+
declare const TEST_ID_PREFIX = "ripplo-test-";
|
|
4
5
|
interface EngineRunResult {
|
|
5
6
|
readonly cookies: ReadonlyArray<CookieEntry>;
|
|
6
7
|
readonly data: Record<string, Record<string, Primitive>>;
|
|
@@ -57,4 +58,4 @@ interface EngineImpls<P extends PreconditionRegistry, O extends ObserverRegistry
|
|
|
57
58
|
}
|
|
58
59
|
declare function createEngine<P extends PreconditionRegistry, O extends ObserverRegistry>(ripplo: RipploInstance<P, O>, impls: EngineImpls<P, O>): RipploEngine;
|
|
59
60
|
|
|
60
|
-
export { type EngineRunResult as E, type NotImplemented as N, type ObserverImplFnFor as O, type PreconditionImplFor as P, type RipploEngine as R, type TeardownRunResult as T, type EngineImpls as a, type ExecuteBatchItem as b, type ExecuteBatchOptions as c, type TeardownBatchItem as
|
|
61
|
+
export { type EngineRunResult as E, type NotImplemented as N, type ObserverImplFnFor as O, type PreconditionImplFor as P, type RipploEngine as R, type TeardownRunResult as T, type EngineImpls as a, type ExecuteBatchItem as b, type ExecuteBatchOptions as c, TEST_ID_PREFIX as d, type TeardownBatchItem as e, createEngine as f, notImplemented as n };
|
package/dist/express.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { R as RipploEngine } from './engine-
|
|
3
|
-
import './builder-
|
|
2
|
+
import { R as RipploEngine } from './engine-BOqzK_go.js';
|
|
3
|
+
import './builder-SsgqYqSC.js';
|
|
4
4
|
import './types-BzZrl65Z.js';
|
|
5
5
|
import './step-De52hTLd.js';
|
|
6
6
|
import '@ripplo/spec';
|
package/dist/fastify.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FastifyInstance } from 'fastify';
|
|
2
|
-
import { R as RipploEngine } from './engine-
|
|
3
|
-
import './builder-
|
|
2
|
+
import { R as RipploEngine } from './engine-BOqzK_go.js';
|
|
3
|
+
import './builder-SsgqYqSC.js';
|
|
4
4
|
import './types-BzZrl65Z.js';
|
|
5
5
|
import './step-De52hTLd.js';
|
|
6
6
|
import '@ripplo/spec';
|
package/dist/hono.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import { R as RipploEngine } from './engine-
|
|
3
|
-
import './builder-
|
|
2
|
+
import { R as RipploEngine } from './engine-BOqzK_go.js';
|
|
3
|
+
import './builder-SsgqYqSC.js';
|
|
4
4
|
import './types-BzZrl65Z.js';
|
|
5
5
|
import './step-De52hTLd.js';
|
|
6
6
|
import '@ripplo/spec';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { C as CoverageRegistry, O as ObserverImplFn, a as ObserverRegistry, P as PreconditionImpl, b as PreconditionRecord, c as PreconditionRegistry, R as ResolveDeps,
|
|
1
|
+
export { C as CoverageRegistry, O as ObserverImplFn, a as ObserverRegistry, P as PreconditionImpl, b as PreconditionRecord, c as PreconditionRegistry, d as PreconditionSetupItem, e as PreconditionTeardownItem, R as ResolveDeps, f as RipploBuilder, g as RipploInstance, h as RipploRegistries, i as createRipplo, o as observer, p as precondition, t as test } from './builder-SsgqYqSC.js';
|
|
2
2
|
import { CompileResult } from './compiler.js';
|
|
3
3
|
export { CompiledTest, compile } from './compiler.js';
|
|
4
|
-
import { E as EngineRunResult, T as TeardownRunResult$1 } from './engine-
|
|
5
|
-
export { a as EngineImpls, b as ExecuteBatchItem, c as ExecuteBatchOptions, N as NotImplemented, O as ObserverImplFnFor, P as PreconditionImplFor, R as RipploEngine, d as
|
|
4
|
+
import { E as EngineRunResult, T as TeardownRunResult$1 } from './engine-BOqzK_go.js';
|
|
5
|
+
export { a as EngineImpls, b as ExecuteBatchItem, c as ExecuteBatchOptions, N as NotImplemented, O as ObserverImplFnFor, P as PreconditionImplFor, R as RipploEngine, d as TEST_ID_PREFIX, e as TeardownBatchItem, f as createEngine, n as notImplemented } from './engine-BOqzK_go.js';
|
|
6
6
|
import { C as CookieEntry } from './types-BzZrl65Z.js';
|
|
7
7
|
export { c as CookieOptions, D as DEFAULT_IGNORE_PATHS, d as DEFAULT_WATCH_PATHS, e as ObserverContext, f as ObserverDefinition, O as ObserverHandle, a as ObserverInput, g as ObserverOutcome, h as Precondition, i as PreconditionDeps, P as Primitive, S as SetupContext, T as TeardownContext, j as TestDefinition, k as TestValue } from './types-BzZrl65Z.js';
|
|
8
8
|
export { D as DslNodeInput } from './step-De52hTLd.js';
|
package/dist/index.js
CHANGED
|
@@ -849,6 +849,7 @@ var RULES = [
|
|
|
849
849
|
];
|
|
850
850
|
|
|
851
851
|
// src/engine.ts
|
|
852
|
+
var TEST_ID_PREFIX = "ripplo-test-";
|
|
852
853
|
function notImplemented(reason) {
|
|
853
854
|
return { reason: reason ?? "not implemented" };
|
|
854
855
|
}
|
|
@@ -1232,6 +1233,11 @@ function createSetupContext({
|
|
|
1232
1233
|
defaultDomain,
|
|
1233
1234
|
runId
|
|
1234
1235
|
}) {
|
|
1236
|
+
let callCounter = 0;
|
|
1237
|
+
const nextSuffix = () => {
|
|
1238
|
+
callCounter += 1;
|
|
1239
|
+
return `${runId}-${String(callCounter)}`;
|
|
1240
|
+
};
|
|
1235
1241
|
return {
|
|
1236
1242
|
runId,
|
|
1237
1243
|
fixed: (value) => brandTestValue(value),
|
|
@@ -1239,8 +1245,8 @@ function createSetupContext({
|
|
|
1239
1245
|
const resolvedOptions = options != null && options.domain == null && defaultDomain != null ? { ...options, domain: defaultDomain } : options ?? void 0;
|
|
1240
1246
|
cookies.push({ name, options: resolvedOptions, value });
|
|
1241
1247
|
},
|
|
1242
|
-
uniqueEmail: () => brandTestValue(
|
|
1243
|
-
uniqueId: (prefix) => brandTestValue(
|
|
1248
|
+
uniqueEmail: () => brandTestValue(`${TEST_ID_PREFIX}${nextSuffix()}@test.ripplo.ai`),
|
|
1249
|
+
uniqueId: (prefix) => brandTestValue(`${TEST_ID_PREFIX}${prefix}-${nextSuffix()}`)
|
|
1244
1250
|
};
|
|
1245
1251
|
}
|
|
1246
1252
|
function deriveDefaultDomain(baseUrl) {
|
|
@@ -1256,6 +1262,7 @@ function deriveDefaultDomain(baseUrl) {
|
|
|
1256
1262
|
export {
|
|
1257
1263
|
DEFAULT_IGNORE_PATHS,
|
|
1258
1264
|
DEFAULT_WATCH_PATHS,
|
|
1265
|
+
TEST_ID_PREFIX,
|
|
1259
1266
|
compile,
|
|
1260
1267
|
createEngine,
|
|
1261
1268
|
createRipplo,
|
package/dist/koa.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Middleware } from 'koa';
|
|
2
|
-
import { R as RipploEngine } from './engine-
|
|
3
|
-
import './builder-
|
|
2
|
+
import { R as RipploEngine } from './engine-BOqzK_go.js';
|
|
3
|
+
import './builder-SsgqYqSC.js';
|
|
4
4
|
import './types-BzZrl65Z.js';
|
|
5
5
|
import './step-De52hTLd.js';
|
|
6
6
|
import '@ripplo/spec';
|
package/dist/lockfile.d.ts
CHANGED
package/dist/nestjs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DynamicModule } from '@nestjs/common';
|
|
2
|
-
import { R as RipploEngine } from './engine-
|
|
3
|
-
import './builder-
|
|
2
|
+
import { R as RipploEngine } from './engine-BOqzK_go.js';
|
|
3
|
+
import './builder-SsgqYqSC.js';
|
|
4
4
|
import './types-BzZrl65Z.js';
|
|
5
5
|
import './step-De52hTLd.js';
|
|
6
6
|
import '@ripplo/spec';
|
package/dist/nextjs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RipploEngine } from './engine-
|
|
2
|
-
import './builder-
|
|
1
|
+
import { R as RipploEngine } from './engine-BOqzK_go.js';
|
|
2
|
+
import './builder-SsgqYqSC.js';
|
|
3
3
|
import './types-BzZrl65Z.js';
|
|
4
4
|
import './step-De52hTLd.js';
|
|
5
5
|
import '@ripplo/spec';
|
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.5.
|
|
4
|
+
"version": "0.5.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"tsup": "^8.5.1",
|
|
100
100
|
"typescript": "catalog:",
|
|
101
101
|
"vitest": "^4.1.4",
|
|
102
|
-
"@ripplo/
|
|
103
|
-
"@ripplo/
|
|
102
|
+
"@ripplo/eslint-config": "0.0.0",
|
|
103
|
+
"@ripplo/spec": "^0.0.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"@nestjs/common": "^10.0.0 || ^11.0.0",
|