@ontrails/testing 1.0.0-beta.2 → 1.0.0-beta.21
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/CHANGELOG.md +396 -5
- package/README.md +86 -22
- package/package.json +34 -5
- package/src/all-established.ts +168 -0
- package/src/all.ts +51 -12
- package/src/assertions.ts +253 -0
- package/src/cli.ts +6 -0
- package/src/composes.ts +433 -0
- package/src/context.ts +200 -14
- package/src/contracts.ts +45 -21
- package/src/detours.ts +155 -18
- package/src/effective-examples.ts +414 -0
- package/src/errors.ts +47 -0
- package/src/examples.ts +302 -177
- package/src/harness-cli.ts +83 -58
- package/src/harness-http.ts +341 -0
- package/src/harness-mcp.ts +46 -16
- package/src/http.ts +10 -0
- package/src/index.ts +22 -14
- package/src/logger.ts +3 -1
- package/src/mcp.ts +6 -0
- package/src/scenario.ts +375 -0
- package/src/signals.ts +221 -0
- package/src/surface-parity.ts +389 -0
- package/src/trail.ts +1 -1
- package/src/types.ts +24 -52
- package/.turbo/turbo-build.log +0 -1
- package/.turbo/turbo-lint.log +0 -3
- package/.turbo/turbo-typecheck.log +0 -1
- package/dist/all.d.ts +0 -30
- package/dist/all.d.ts.map +0 -1
- package/dist/all.js +0 -47
- package/dist/all.js.map +0 -1
- package/dist/assertions.d.ts +0 -49
- package/dist/assertions.d.ts.map +0 -1
- package/dist/assertions.js +0 -84
- package/dist/assertions.js.map +0 -1
- package/dist/context.d.ts +0 -19
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -33
- package/dist/context.js.map +0 -1
- package/dist/contracts.d.ts +0 -16
- package/dist/contracts.d.ts.map +0 -1
- package/dist/contracts.js +0 -56
- package/dist/contracts.js.map +0 -1
- package/dist/detours.d.ts +0 -12
- package/dist/detours.d.ts.map +0 -1
- package/dist/detours.js +0 -30
- package/dist/detours.js.map +0 -1
- package/dist/examples.d.ts +0 -22
- package/dist/examples.d.ts.map +0 -1
- package/dist/examples.js +0 -187
- package/dist/examples.js.map +0 -1
- package/dist/harness-cli.d.ts +0 -21
- package/dist/harness-cli.d.ts.map +0 -1
- package/dist/harness-cli.js +0 -213
- package/dist/harness-cli.js.map +0 -1
- package/dist/harness-mcp.d.ts +0 -21
- package/dist/harness-mcp.d.ts.map +0 -1
- package/dist/harness-mcp.js +0 -50
- package/dist/harness-mcp.js.map +0 -1
- package/dist/hike.d.ts +0 -32
- package/dist/hike.d.ts.map +0 -1
- package/dist/hike.js +0 -169
- package/dist/hike.js.map +0 -1
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -15
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -87
- package/dist/logger.js.map +0 -1
- package/dist/trail.d.ts +0 -20
- package/dist/trail.d.ts.map +0 -1
- package/dist/trail.js +0 -80
- package/dist/trail.js.map +0 -1
- package/dist/types.d.ts +0 -80
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -5
- package/dist/types.js.map +0 -1
- package/src/__tests__/context.test.ts +0 -60
- package/src/__tests__/contracts.test.ts +0 -68
- package/src/__tests__/detours.test.ts +0 -55
- package/src/__tests__/examples.test.ts +0 -176
- package/src/__tests__/hike.test.ts +0 -164
- package/src/__tests__/logger.test.ts +0 -136
- package/src/__tests__/trail.test.ts +0 -99
- package/src/hike.ts +0 -283
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
package/dist/assertions.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Progressive assertion logic for example-driven testing.
|
|
3
|
-
*
|
|
4
|
-
* Three tiers:
|
|
5
|
-
* 1. Full match — example has `expected` output
|
|
6
|
-
* 2. Schema-only — no expected output, no error
|
|
7
|
-
* 3. Error match — example declares an error class name
|
|
8
|
-
*/
|
|
9
|
-
import { expect } from 'bun:test';
|
|
10
|
-
import { formatZodIssues } from '@ontrails/core';
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
// Result narrowing helpers
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
/**
|
|
15
|
-
* Assert that a Result is Ok and return its value.
|
|
16
|
-
*
|
|
17
|
-
* Eliminates the `if (result.isOk())` / `as unknown as` dance in tests.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const value = expectOk(result);
|
|
22
|
-
* expect(value.name).toBe('Alice');
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export const expectOk = (result) => {
|
|
26
|
-
expect(result.isOk()).toBe(true);
|
|
27
|
-
return result.value;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Assert that a Result is Err and return its error.
|
|
31
|
-
*
|
|
32
|
-
* Eliminates the `if (result.isErr())` / `as unknown as` dance in tests.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const error = expectErr(result);
|
|
37
|
-
* expect(error).toBeInstanceOf(ValidationError);
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export const expectErr = (result) => {
|
|
41
|
-
expect(result.isErr()).toBe(true);
|
|
42
|
-
return result.error;
|
|
43
|
-
};
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
// Full Match
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
/**
|
|
48
|
-
* Assert that the result is ok and its value deep-equals the expected output.
|
|
49
|
-
*/
|
|
50
|
-
export const assertFullMatch = (result, expected) => {
|
|
51
|
-
const value = expectOk(result);
|
|
52
|
-
expect(value).toEqual(expected);
|
|
53
|
-
};
|
|
54
|
-
// ---------------------------------------------------------------------------
|
|
55
|
-
// Schema-Only Match
|
|
56
|
-
// ---------------------------------------------------------------------------
|
|
57
|
-
/**
|
|
58
|
-
* Assert that the result is ok and, if an output schema is provided,
|
|
59
|
-
* the value parses against it.
|
|
60
|
-
*/
|
|
61
|
-
export const assertSchemaMatch = (result, outputSchema) => {
|
|
62
|
-
const value = expectOk(result);
|
|
63
|
-
if (outputSchema !== undefined) {
|
|
64
|
-
const parsed = outputSchema.safeParse(value);
|
|
65
|
-
if (!parsed.success) {
|
|
66
|
-
throw new Error(`Output does not match schema: ${formatZodIssues(parsed.error.issues).join('; ')}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
// ---------------------------------------------------------------------------
|
|
71
|
-
// Error Match
|
|
72
|
-
// ---------------------------------------------------------------------------
|
|
73
|
-
/**
|
|
74
|
-
* Assert that the result is an error of the specified type, with optional
|
|
75
|
-
* message substring matching.
|
|
76
|
-
*/
|
|
77
|
-
export const assertErrorMatch = (result, expectedError, expectedMessage) => {
|
|
78
|
-
const error = expectErr(result);
|
|
79
|
-
expect(error).toBeInstanceOf(expectedError);
|
|
80
|
-
if (expectedMessage !== undefined) {
|
|
81
|
-
expect(error.message).toContain(expectedMessage);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
//# sourceMappingURL=assertions.js.map
|
package/dist/assertions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,8EAA8E;AAC9E,2BAA2B;AAC3B,8EAA8E;AAE9E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAO,MAAoB,EAAK,EAAE;IACxD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,OAAQ,MAAkC,CAAC,KAAK,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,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CAAC,CAAC;IAC5C,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC"}
|
package/dist/context.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test context factory for creating TrailContext instances suitable for testing.
|
|
3
|
-
*/
|
|
4
|
-
import type { TrailContext } from '@ontrails/core';
|
|
5
|
-
import type { TestTrailContextOptions } from './types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Create a TrailContext with deterministic, test-friendly defaults.
|
|
8
|
-
*
|
|
9
|
-
* - `requestId`: `"test-request-001"` (deterministic)
|
|
10
|
-
* - `logger`: a `TestLogger` that captures entries
|
|
11
|
-
* - `signal`: a non-aborted AbortController signal
|
|
12
|
-
*/
|
|
13
|
-
export declare const createTestContext: (overrides?: TestTrailContextOptions) => TrailContext;
|
|
14
|
-
/**
|
|
15
|
-
* Merge a Partial<TrailContext> into a test context.
|
|
16
|
-
* Used internally when the public API accepts Partial<TrailContext>.
|
|
17
|
-
*/
|
|
18
|
-
export declare const mergeTestContext: (ctx?: Partial<TrailContext>) => TrailContext;
|
|
19
|
-
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAM1D;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,uBAAuB,KAClC,YAMD,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,OAAO,CAAC,YAAY,CAAC,KAAG,YAO9D,CAAC"}
|
package/dist/context.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test context factory for creating TrailContext instances suitable for testing.
|
|
3
|
-
*/
|
|
4
|
-
import { createTestLogger } from './logger.js';
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
// createTestContext
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
/**
|
|
9
|
-
* Create a TrailContext with deterministic, test-friendly defaults.
|
|
10
|
-
*
|
|
11
|
-
* - `requestId`: `"test-request-001"` (deterministic)
|
|
12
|
-
* - `logger`: a `TestLogger` that captures entries
|
|
13
|
-
* - `signal`: a non-aborted AbortController signal
|
|
14
|
-
*/
|
|
15
|
-
export const createTestContext = (overrides) => ({
|
|
16
|
-
env: overrides?.env ?? { TRAILS_ENV: 'test' },
|
|
17
|
-
logger: overrides?.logger ?? createTestLogger(),
|
|
18
|
-
requestId: overrides?.requestId ?? 'test-request-001',
|
|
19
|
-
signal: overrides?.signal ?? new AbortController().signal,
|
|
20
|
-
workspaceRoot: overrides?.cwd ?? process.cwd(),
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Merge a Partial<TrailContext> into a test context.
|
|
24
|
-
* Used internally when the public API accepts Partial<TrailContext>.
|
|
25
|
-
*/
|
|
26
|
-
export const mergeTestContext = (ctx) => {
|
|
27
|
-
if (ctx === undefined) {
|
|
28
|
-
return createTestContext();
|
|
29
|
-
}
|
|
30
|
-
const base = createTestContext();
|
|
31
|
-
return { ...base, ...ctx };
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,SAAmC,EACrB,EAAE,CAAC,CAAC;IAClB,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE;IAC7C,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,gBAAgB,EAAE;IAC/C,SAAS,EAAE,SAAS,EAAE,SAAS,IAAI,kBAAkB;IACrD,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC,MAAM;IACzD,aAAa,EAAE,SAAS,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;CAC/C,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAA2B,EAAgB,EAAE;IAC5E,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;IAED,MAAM,IAAI,GAAG,iBAAiB,EAAE,CAAC;IACjC,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,GAAG,EAAE,CAAC;AAC7B,CAAC,CAAC"}
|
package/dist/contracts.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testContracts — output schema verification.
|
|
3
|
-
*
|
|
4
|
-
* For every trail that has both examples and an output schema,
|
|
5
|
-
* run each example and validate the implementation output against
|
|
6
|
-
* the declared schema.
|
|
7
|
-
*/
|
|
8
|
-
import type { Topo, TrailContext } from '@ontrails/core';
|
|
9
|
-
/**
|
|
10
|
-
* Verify that every trail's implementation output matches its declared
|
|
11
|
-
* output schema. Catches implementation-schema drift.
|
|
12
|
-
*
|
|
13
|
-
* Trails without output schemas or examples are skipped.
|
|
14
|
-
*/
|
|
15
|
-
export declare const testContracts: (app: Topo, ctxOrFactory?: Partial<TrailContext> | (() => Partial<TrailContext>)) => void;
|
|
16
|
-
//# sourceMappingURL=contracts.d.ts.map
|
package/dist/contracts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAuB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA8B9E;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,IAAI,EACT,eAAe,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,KACnE,IAmCF,CAAC"}
|
package/dist/contracts.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testContracts — output schema verification.
|
|
3
|
-
*
|
|
4
|
-
* For every trail that has both examples and an output schema,
|
|
5
|
-
* run each example and validate the implementation output against
|
|
6
|
-
* the declared schema.
|
|
7
|
-
*/
|
|
8
|
-
import { describe, test } from 'bun:test';
|
|
9
|
-
import { formatZodIssues, validateInput } from '@ontrails/core';
|
|
10
|
-
import { expectOk } from './assertions.js';
|
|
11
|
-
import { mergeTestContext } from './context.js';
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
// Helpers
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
|
-
const validateOutputSchema = (outputSchema, value, trailId, exampleName) => {
|
|
16
|
-
const parsed = outputSchema.safeParse(value);
|
|
17
|
-
if (!parsed.success) {
|
|
18
|
-
const issues = formatZodIssues(parsed.error.issues);
|
|
19
|
-
throw new Error(`Output schema violation for trail "${trailId}", example "${exampleName}":\n${issues.map((i) => ` - ${i}`).join('\n')}\n\nActual output: ${JSON.stringify(value, null, 2)}`);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
// testContracts
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
/**
|
|
26
|
-
* Verify that every trail's implementation output matches its declared
|
|
27
|
-
* output schema. Catches implementation-schema drift.
|
|
28
|
-
*
|
|
29
|
-
* Trails without output schemas or examples are skipped.
|
|
30
|
-
*/
|
|
31
|
-
export const testContracts = (app, ctxOrFactory) => {
|
|
32
|
-
const resolveCtx = typeof ctxOrFactory === 'function' ? ctxOrFactory : () => ctxOrFactory;
|
|
33
|
-
const trailEntries = [...app.trails];
|
|
34
|
-
describe('contracts', () => {
|
|
35
|
-
describe.each(trailEntries)('%s', (_id, trailDef) => {
|
|
36
|
-
const t = trailDef;
|
|
37
|
-
if (t.output === undefined) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (t.examples === undefined || t.examples.length === 0) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const { examples, output: outputSchema } = t;
|
|
44
|
-
const successExamples = examples.filter((e) => e.error === undefined);
|
|
45
|
-
test.each(successExamples)('contract: $name', async (example) => {
|
|
46
|
-
const testCtx = mergeTestContext(resolveCtx());
|
|
47
|
-
const validated = validateInput(t.input, example.input);
|
|
48
|
-
const validatedInput = expectOk(validated);
|
|
49
|
-
const result = await t.implementation(validatedInput, testCtx);
|
|
50
|
-
const resultValue = expectOk(result);
|
|
51
|
-
validateOutputSchema(outputSchema, resultValue, t.id, example.name);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
//# sourceMappingURL=contracts.js.map
|
package/dist/contracts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cA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K,SAAS,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxD,OAAO;YACT,CAAC;YAED,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;YAC7C,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;YAEtE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CACxB,iBAAiB,EACjB,KAAK,EAAE,OAAuC,EAAE,EAAE;gBAChD,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAC;gBAE/C,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;gBACxD,MAAM,cAAc,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;gBAE3C,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,cAAc,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;gBAC/D,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAErC,oBAAoB,CAAC,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;YACtE,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/detours.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testDetours — verify that all detour targets exist in the topo.
|
|
3
|
-
*
|
|
4
|
-
* Pure structural validation. No implementation execution needed.
|
|
5
|
-
*/
|
|
6
|
-
import type { Topo } from '@ontrails/core';
|
|
7
|
-
/**
|
|
8
|
-
* Verify that every trail's detour targets reference trails that
|
|
9
|
-
* actually exist in the app's topo.
|
|
10
|
-
*/
|
|
11
|
-
export declare const testDetours: (app: Topo) => void;
|
|
12
|
-
//# sourceMappingURL=detours.d.ts.map
|
package/dist/detours.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detours.d.ts","sourceRoot":"","sources":["../src/detours.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,gBAAgB,CAAC;AAMlD;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,IAAI,KAAG,IAyBvC,CAAC"}
|
package/dist/detours.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testDetours — verify that all detour targets exist in the topo.
|
|
3
|
-
*
|
|
4
|
-
* Pure structural validation. No implementation execution needed.
|
|
5
|
-
*/
|
|
6
|
-
import { describe, expect, test } from 'bun:test';
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
// testDetours
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
/**
|
|
11
|
-
* Verify that every trail's detour targets reference trails that
|
|
12
|
-
* actually exist in the app's topo.
|
|
13
|
-
*/
|
|
14
|
-
export const testDetours = (app) => {
|
|
15
|
-
const trailEntries = [...app.trails];
|
|
16
|
-
describe('detours', () => {
|
|
17
|
-
describe.each(trailEntries)('%s', (_id, trailDef) => {
|
|
18
|
-
const t = trailDef;
|
|
19
|
-
if (t.detours === undefined) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const { detours } = t;
|
|
23
|
-
const testCases = Object.entries(detours).flatMap(([detourName, targets]) => targets.map((targetId) => ({ detourName, targetId })));
|
|
24
|
-
test.each(testCases)('detour "$detourName" -> "$targetId" exists', ({ targetId }) => {
|
|
25
|
-
expect(app.has(targetId)).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=detours.js.map
|
package/dist/detours.js.map
DELETED
|
@@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
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testExamples — the headline one-liner.
|
|
3
|
-
*
|
|
4
|
-
* Iterates every trail in the app's topo. For each trail with examples,
|
|
5
|
-
* generates describe/test blocks using bun:test. Progressive assertion
|
|
6
|
-
* determines which check to run per example. For hikes with `follows`
|
|
7
|
-
* declarations, checks that every declared follow was called at least once.
|
|
8
|
-
*/
|
|
9
|
-
import type { Topo, TrailContext } from '@ontrails/core';
|
|
10
|
-
/**
|
|
11
|
-
* Generate describe/test blocks for every trail example in the app.
|
|
12
|
-
*
|
|
13
|
-
* For hikes with `follows` declarations and examples, also verifies that
|
|
14
|
-
* every declared follow ID was called at least once across all examples.
|
|
15
|
-
*
|
|
16
|
-
* One line in your test file:
|
|
17
|
-
* ```ts
|
|
18
|
-
* testExamples(app);
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare const testExamples: (app: Topo, ctxOrFactory?: Partial<TrailContext> | (() => Partial<TrailContext>)) => void;
|
|
22
|
-
//# sourceMappingURL=examples.d.ts.map
|
package/dist/examples.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"examples.d.ts","sourceRoot":"","sources":["../src/examples.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAGV,IAAI,EAGJ,YAAY,EACb,MAAM,gBAAgB,CAAC;AAkQxB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,GACvB,KAAK,IAAI,EACT,eAAe,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,KACnE,IAuBF,CAAC"}
|
package/dist/examples.js
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* testExamples — the headline one-liner.
|
|
3
|
-
*
|
|
4
|
-
* Iterates every trail in the app's topo. For each trail with examples,
|
|
5
|
-
* generates describe/test blocks using bun:test. Progressive assertion
|
|
6
|
-
* determines which check to run per example. For hikes with `follows`
|
|
7
|
-
* declarations, checks that every declared follow was called at least once.
|
|
8
|
-
*/
|
|
9
|
-
import { describe, expect, test } from 'bun:test';
|
|
10
|
-
import { AlreadyExistsError, AmbiguousError, AssertionError, AuthError, CancelledError, ConflictError, InternalError, NetworkError, NotFoundError, PermissionError, RateLimitError, Result, TimeoutError, TrailsError, ValidationError, validateInput, } from '@ontrails/core';
|
|
11
|
-
import { assertErrorMatch, assertFullMatch, assertSchemaMatch, expectOk, } from './assertions.js';
|
|
12
|
-
import { mergeTestContext } from './context.js';
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
// Error class name -> constructor map
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
const ERROR_MAP = {
|
|
17
|
-
AlreadyExistsError: AlreadyExistsError,
|
|
18
|
-
AmbiguousError: AmbiguousError,
|
|
19
|
-
AssertionError: AssertionError,
|
|
20
|
-
AuthError: AuthError,
|
|
21
|
-
CancelledError: CancelledError,
|
|
22
|
-
ConflictError: ConflictError,
|
|
23
|
-
InternalError: InternalError,
|
|
24
|
-
NetworkError: NetworkError,
|
|
25
|
-
NotFoundError: NotFoundError,
|
|
26
|
-
PermissionError: PermissionError,
|
|
27
|
-
RateLimitError: RateLimitError,
|
|
28
|
-
TimeoutError: TimeoutError,
|
|
29
|
-
TrailsError: TrailsError,
|
|
30
|
-
ValidationError: ValidationError,
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Resolve an error class name string to the actual constructor.
|
|
34
|
-
* Falls back to generic Error if the name is not in the core taxonomy.
|
|
35
|
-
*/
|
|
36
|
-
const resolveErrorClass = (name) => ERROR_MAP[name] ?? Error;
|
|
37
|
-
// ---------------------------------------------------------------------------
|
|
38
|
-
// Helpers
|
|
39
|
-
// ---------------------------------------------------------------------------
|
|
40
|
-
const assertProgressiveMatch = (result, example, output) => {
|
|
41
|
-
if (example.expected !== undefined) {
|
|
42
|
-
assertFullMatch(result, example.expected);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (example.error !== undefined) {
|
|
46
|
-
const errorClass = resolveErrorClass(example.error);
|
|
47
|
-
assertErrorMatch(result, errorClass);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
assertSchemaMatch(result, output);
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Handle input validation failure for an example.
|
|
54
|
-
* Returns true if the validation error was expected (and assertions passed).
|
|
55
|
-
* Throws if the validation error was unexpected.
|
|
56
|
-
*/
|
|
57
|
-
const handleValidationError = (validated, example) => {
|
|
58
|
-
if (!validated.isErr()) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
if (example.error !== undefined) {
|
|
62
|
-
const errorClass = resolveErrorClass(example.error);
|
|
63
|
-
expect(validated.error).toBeInstanceOf(errorClass);
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
throw new Error(`Example "${example.name}" has invalid input: ${validated.error.message}`);
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Run a single example against a trail.
|
|
70
|
-
* Handles validation, execution, and assertions.
|
|
71
|
-
*/
|
|
72
|
-
const runExample = async (t, example, output, testCtx) => {
|
|
73
|
-
const validated = validateInput(t.input, example.input);
|
|
74
|
-
if (handleValidationError(validated, example)) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const validatedInput = expectOk(validated);
|
|
78
|
-
const result = await t.implementation(validatedInput, testCtx);
|
|
79
|
-
assertProgressiveMatch(result, example, output);
|
|
80
|
-
};
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
|
-
// Follows coverage for hikes
|
|
83
|
-
// ---------------------------------------------------------------------------
|
|
84
|
-
/**
|
|
85
|
-
* Build a recording follow function that tracks which trail IDs are called.
|
|
86
|
-
*
|
|
87
|
-
* Delegates to `baseFollow` when available, otherwise looks up the trail
|
|
88
|
-
* in the topo and executes it with validated input. Falls back to
|
|
89
|
-
* `Result.ok()` when neither is available.
|
|
90
|
-
*/
|
|
91
|
-
const createCoverageFollow = (called, baseFollow, topo, ctx) => {
|
|
92
|
-
const follow = (id, input) => {
|
|
93
|
-
called.add(id);
|
|
94
|
-
if (baseFollow !== undefined) {
|
|
95
|
-
return baseFollow(id, input);
|
|
96
|
-
}
|
|
97
|
-
const trailDef = topo.get(id);
|
|
98
|
-
if (trailDef !== undefined) {
|
|
99
|
-
const validated = validateInput(trailDef.input, input);
|
|
100
|
-
if (validated.isErr()) {
|
|
101
|
-
return Promise.resolve(validated);
|
|
102
|
-
}
|
|
103
|
-
return Promise.resolve(trailDef.implementation(validated.value, ctx));
|
|
104
|
-
}
|
|
105
|
-
return Promise.resolve(Result.ok());
|
|
106
|
-
};
|
|
107
|
-
return follow;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Run a single example against a hike, recording follow calls.
|
|
111
|
-
*/
|
|
112
|
-
const runHikeExample = async (hikeDef, example, output, baseCtx, called, topo) => {
|
|
113
|
-
const validated = validateInput(hikeDef.input, example.input);
|
|
114
|
-
if (handleValidationError(validated, example)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const validatedInput = expectOk(validated);
|
|
118
|
-
const follow = createCoverageFollow(called, baseCtx.follow, topo, baseCtx);
|
|
119
|
-
const testCtx = { ...baseCtx, follow };
|
|
120
|
-
const result = await hikeDef.implementation(validatedInput, testCtx);
|
|
121
|
-
assertProgressiveMatch(result, example, output);
|
|
122
|
-
};
|
|
123
|
-
const collectHikesWithExamples = (app) => [...app.hikes]
|
|
124
|
-
.filter(([, h]) => h.examples !== undefined && h.examples.length > 0)
|
|
125
|
-
.map(([hikeId, hikeDef]) => ({
|
|
126
|
-
examples: hikeDef.examples,
|
|
127
|
-
hikeDef,
|
|
128
|
-
hikeId,
|
|
129
|
-
}));
|
|
130
|
-
// ---------------------------------------------------------------------------
|
|
131
|
-
// Hike example describe blocks
|
|
132
|
-
// ---------------------------------------------------------------------------
|
|
133
|
-
/**
|
|
134
|
-
* Generate describe/test blocks for hikes with follows coverage.
|
|
135
|
-
*
|
|
136
|
-
* Always uses a recording follow so that follows coverage can be checked.
|
|
137
|
-
* Hikes without `follows` still run their examples but skip the coverage test.
|
|
138
|
-
*/
|
|
139
|
-
const describeHikeExamples = (hikesWithExamples, resolveCtx, topo) => {
|
|
140
|
-
if (hikesWithExamples.length === 0) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
describe.each([...hikesWithExamples])('$hikeId', ({ hikeDef, examples }) => {
|
|
144
|
-
const called = new Set();
|
|
145
|
-
test.each([...examples])('example: $name', async (example) => {
|
|
146
|
-
const baseCtx = mergeTestContext(resolveCtx());
|
|
147
|
-
await runHikeExample(hikeDef, example, hikeDef.output, baseCtx, called, topo);
|
|
148
|
-
});
|
|
149
|
-
if (hikeDef.follows.length > 0) {
|
|
150
|
-
test('follows coverage', () => {
|
|
151
|
-
const uncovered = hikeDef.follows.filter((id) => !called.has(id));
|
|
152
|
-
expect(uncovered).toEqual([]);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
// ---------------------------------------------------------------------------
|
|
158
|
-
// testExamples
|
|
159
|
-
// ---------------------------------------------------------------------------
|
|
160
|
-
/**
|
|
161
|
-
* Generate describe/test blocks for every trail example in the app.
|
|
162
|
-
*
|
|
163
|
-
* For hikes with `follows` declarations and examples, also verifies that
|
|
164
|
-
* every declared follow ID was called at least once across all examples.
|
|
165
|
-
*
|
|
166
|
-
* One line in your test file:
|
|
167
|
-
* ```ts
|
|
168
|
-
* testExamples(app);
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
export const testExamples = (app, ctxOrFactory) => {
|
|
172
|
-
const resolveCtx = typeof ctxOrFactory === 'function' ? ctxOrFactory : () => ctxOrFactory;
|
|
173
|
-
const trailEntries = [...app.trails];
|
|
174
|
-
describe.each(trailEntries)('%s', (_id, trailDef) => {
|
|
175
|
-
const t = trailDef;
|
|
176
|
-
if (t.examples === undefined || t.examples.length === 0) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
const { examples, output } = t;
|
|
180
|
-
test.each([...examples])('example: $name', async (example) => {
|
|
181
|
-
const testCtx = mergeTestContext(resolveCtx());
|
|
182
|
-
await runExample(t, example, output, testCtx);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
describeHikeExamples(collectHikesWithExamples(app), resolveCtx, app);
|
|
186
|
-
};
|
|
187
|
-
//# sourceMappingURL=examples.js.map
|
package/dist/examples.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"examples.js","sourceRoot":"","sources":["../src/examples.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAWlD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,MAAM,EACN,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,8EAA8E;AAC9E,sCAAsC;AACtC,8EAA8E;AAE9E,MAAM,SAAS,GAAoD;IACjE,kBAAkB,EAAE,kBAAqD;IACzE,cAAc,EAAE,cAAiD;IACjE,cAAc,EAAE,cAAiD;IACjE,SAAS,EAAE,SAA4C;IACvD,cAAc,EAAE,cAAiD;IACjE,aAAa,EAAE,aAAgD;IAC/D,aAAa,EAAE,aAAgD;IAC/D,YAAY,EAAE,YAA+C;IAC7D,aAAa,EAAE,aAAgD;IAC/D,eAAe,EAAE,eAA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
-
* and captures stdout/stderr.
|
|
6
|
-
*/
|
|
7
|
-
import type { CliHarness, CliHarnessOptions } from './types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create a CLI harness for integration testing.
|
|
10
|
-
*
|
|
11
|
-
* Builds commands from the app's topo and provides a `run()` method
|
|
12
|
-
* that parses command strings and executes them in-process.
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* const harness = createCliHarness({ app });
|
|
16
|
-
* const result = await harness.run("entity show --name Alpha --output json");
|
|
17
|
-
* expect(result.exitCode).toBe(0);
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare const createCliHarness: (options: CliHarnessOptions) => CliHarness;
|
|
21
|
-
//# sourceMappingURL=harness-cli.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"harness-cli.d.ts","sourceRoot":"","sources":["../src/harness-cli.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAoRpB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,iBAAiB,KAAG,UAM7D,CAAC"}
|