@shivaedev/effect-trpc 0.3.1 → 0.3.3

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 CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.3.3 - 2026-08-30
6
+
7
+ ### Changed
8
+
9
+ - Build `makeTrpcIt` and `makeTrpcHarnessIt` on `@shivaedev/effect-test`
10
+ instead of a private Vitest runner.
11
+
12
+ ### Added
13
+
14
+ - Accept `clock: "live"` on `makeTrpcIt`, `makeTrpcHarnessIt`, and
15
+ `effectTRPC` tests to use wall-clock time instead of TestClock.
16
+
17
+ ## 0.3.2 - 2026-08-12
18
+
19
+ ### Changed
20
+
21
+ - Require Effect 4.0.0-rc.108. The 4.0 release candidate starts the stable line,
22
+ so consumers pick up the compatibility promise the betas did not carry.
23
+
5
24
  ## 0.3.1 - 2026-08-12
6
25
 
7
26
  ### Changed
package/README.md CHANGED
@@ -152,6 +152,7 @@ The test Layer is built once per worker. Its services override matching
152
152
  application runtime services while all other runtime services remain available.
153
153
  Use `around` to add application-wide test behavior such as a rollback wrapper.
154
154
  `effectTRPC` supports `skip`, `skipIf`, `runIf`, `only`, `each`, and `fails`.
155
+ Tests install TestClock unless you pass `clock: "live"`.
155
156
 
156
157
  `makeTrpcHarnessIt` builds an application-defined Effectful harness around the
157
158
  caller when tests need additional services or fixtures. The harness is created
@@ -1,14 +1,15 @@
1
- import type { TestContext, TestOptions, Vitest } from "@effect/vitest";
1
+ import type { TestContext, Vitest } from "@effect/vitest";
2
+ import type { EffectClock, EffectTestOptions } from "@shivaedev/effect-test";
2
3
  import type { Effect, Layer } from "effect";
3
4
  import type { EffectTRPCAdapter } from "../adapter.js";
4
5
  import type { EffectCallerFactory } from "./caller.js";
5
- export type TrpcHarnessTest<Harness, Provided> = <A, Eff extends Effect.Effect<unknown, unknown, Provided>>(name: string, body: (harness: Harness, context: TestContext) => Generator<Eff, A, never>, options?: number | TestOptions) => void;
6
+ export type TrpcHarnessTest<Harness, Provided> = <A, Eff extends Effect.Effect<unknown, unknown, Provided>>(name: string, body: (harness: Harness, context: TestContext) => Generator<Eff, A, never>, options?: number | EffectTestOptions) => void;
6
7
  export interface TrpcHarnessTester<Harness, Provided> extends TrpcHarnessTest<Harness, Provided> {
7
8
  readonly skip: TrpcHarnessTest<Harness, Provided>;
8
9
  readonly skipIf: (condition: unknown) => TrpcHarnessTest<Harness, Provided>;
9
10
  readonly runIf: (condition: unknown) => TrpcHarnessTest<Harness, Provided>;
10
11
  readonly only: TrpcHarnessTest<Harness, Provided>;
11
- readonly each: <Item>(cases: ReadonlyArray<Item>) => <A, Eff extends Effect.Effect<unknown, unknown, Provided>>(name: string, body: (item: Item, harness: Harness, context: TestContext) => Generator<Eff, A, never>, options?: number | TestOptions) => void;
12
+ readonly each: <Item>(cases: ReadonlyArray<Item>) => <A, Eff extends Effect.Effect<unknown, unknown, Provided>>(name: string, body: (item: Item, harness: Harness, context: TestContext) => Generator<Eff, A, never>, options?: number | EffectTestOptions) => void;
12
13
  readonly fails: TrpcHarnessTest<Harness, Provided>;
13
14
  }
14
15
  export type TrpcTest<Options, Caller, Provided> = TrpcHarnessTest<EffectCallerFactory<Options, Caller>, Provided>;
@@ -19,17 +20,10 @@ export type TrpcIt<Options, Caller, Provided> = Vitest.Methods & {
19
20
  export type TrpcHarnessIt<Harness, Provided> = Vitest.Methods & {
20
21
  readonly effectTRPC: TrpcHarnessTester<Harness, Provided>;
21
22
  };
22
- export interface TrpcHarnessTestRuntimeOptions<Options, Caller extends object, Harness, Provided, LayerError> {
23
- readonly adapter: Pick<EffectTRPCAdapter<never>, "runWithServices">;
24
- readonly around?: <A, E>(effect: Effect.Effect<A, E, Provided>) => Effect.Effect<A, unknown, Provided>;
25
- readonly createCaller: (options?: Options) => Caller;
26
- readonly layer: Layer.Layer<Provided, LayerError>;
27
- readonly makeHarness: (trpc: EffectCallerFactory<Options, Caller>, context: TestContext) => Effect.Effect<Harness, unknown, Provided>;
28
- }
29
- export type TrpcTestRuntimeOptions<Options, Caller extends object, Provided, LayerError> = Omit<TrpcHarnessTestRuntimeOptions<Options, Caller, EffectCallerFactory<Options, Caller>, Provided, LayerError>, "makeHarness">;
30
23
  export interface MakeTrpcItOptions<CreateCaller extends (...arguments_: never[]) => object, TestLayer extends Layer.Layer<any, any, never>> {
31
24
  readonly adapter: Pick<EffectTRPCAdapter<never>, "runWithServices">;
32
25
  readonly around?: <A, E>(effect: Effect.Effect<A, E, Layer.Success<TestLayer>>) => Effect.Effect<A, unknown, Layer.Success<TestLayer>>;
26
+ readonly clock?: EffectClock;
33
27
  readonly createCaller: CreateCaller;
34
28
  readonly layer: TestLayer;
35
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/testing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,MAAM,eAAe,CAAC,OAAO,EAAE,QAAQ,IAAI,CAChD,CAAC,EACD,GAAG,SAAS,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAErD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,KAAK,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,EAC1E,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,KAC1B,IAAI,CAAC;AAEV,MAAM,WAAW,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CACnD,SAAQ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D,OAAO,EAAE,WAAW,KAChB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;CAC/D;AAED,MAAM,MAAM,aAAa,CAAC,YAAY,IAAI,YAAY,SAAS,CAC9D,GAAG,UAAU,EAAE,MAAM,SAAS,KAC1B,MAAM,GACR,SAAS,CAAC,CAAC,CAAC,GACZ,KAAK,CAAC;AAET,MAAM,MAAM,YAAY,CAAC,YAAY,IAAI,YAAY,SAAS,CAC7D,GAAG,UAAU,EAAE,MAAM,UAAU,KAC3B,MAAM,MAAM,GACd,MAAM,SAAS,MAAM,GACpB,MAAM,GACN,KAAK,GACN,KAAK,CAAC"}
@@ -1,5 +1,5 @@
1
- import { Layer } from "effect";
1
+ import { type Layer } from "effect";
2
2
  import type { CallerOptions, CallerResult, MakeTrpcHarnessItOptions, MakeTrpcItOptions, TrpcHarnessIt, TrpcIt } from "./types.js";
3
- export declare const makeTrpcIt: <CreateCaller extends (...arguments_: never[]) => object, TestLayer extends Layer.Layer<any, any, never>>(options: MakeTrpcItOptions<CreateCaller, TestLayer>) => TrpcIt<CallerOptions<CreateCaller>, CallerResult<CreateCaller>, Layer.Success<TestLayer>>;
4
3
  export declare const makeTrpcHarnessIt: <CreateCaller extends (...arguments_: never[]) => object, TestLayer extends Layer.Layer<any, any, never>, Harness>(options: MakeTrpcHarnessItOptions<CreateCaller, TestLayer, Harness>) => TrpcHarnessIt<Harness, Layer.Success<TestLayer>>;
4
+ export declare const makeTrpcIt: <CreateCaller extends (...arguments_: never[]) => object, TestLayer extends Layer.Layer<any, any, never>>(options: MakeTrpcItOptions<CreateCaller, TestLayer>) => TrpcIt<CallerOptions<CreateCaller>, CallerResult<CreateCaller>, Layer.Success<TestLayer>>;
5
5
  //# sourceMappingURL=vitest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../src/testing/vitest.ts"],"names":[],"m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K,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAC9C,OAAO,EAEP,SAAS,wBAAwB,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,KACjE,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAwBjD,CAAC;AAEF,eAAO,MAAM,UAAU,GACtB,YAAY,SAAS,CAAC,GAAG,UAAU,EAAE,KAAK,EAAE,KAAK,MAAM,EAEvD,SAAS,SAAS,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAE9C,SAAS,iBAAiB,CAAC,YAAY,EAAE,SAAS,CAAC,KACjD,MAAM,CACR,aAAa,CAAC,YAAY,CAAC,EAC3B,YAAY,CAAC,YAAY,CAAC,EAC1B,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CASvB,CAAC"}
@@ -1,19 +1,7 @@
1
1
  import { it as effectIt } from "@effect/vitest";
2
- import { Effect, Exit, Layer, Scope } from "effect";
3
- import { fixtureName, makeTrpcHarnessTester, makeTrpcTester, } from "../internal/vitest-trpc.js";
4
- const makeFixtureIt = (layer) => effectIt.extend(fixtureName, { scope: "worker" },
5
- // biome-ignore lint/correctness/noEmptyPattern: Vitest fixtures require a destructured context parameter.
6
- async ({}, { onCleanup }) => {
7
- const scope = Effect.runSync(Scope.make());
8
- onCleanup(() => Effect.runPromise(Scope.close(scope, Exit.void)));
9
- try {
10
- return await Effect.runPromise(Layer.buildWithScope(layer, scope));
11
- }
12
- catch (error) {
13
- await Effect.runPromise(Scope.close(scope, Exit.void));
14
- throw error;
15
- }
16
- });
2
+ import { makeEffectIt } from "@shivaedev/effect-test";
3
+ import { Effect } from "effect";
4
+ import { makeEffectCallerFactory } from "./caller.js";
17
5
  const withEffectTRPC = (tester) => new Proxy(effectIt, {
18
6
  get(target, property, receiver) {
19
7
  if (property === "effectTRPC") {
@@ -22,14 +10,24 @@ const withEffectTRPC = (tester) => new Proxy(effectIt, {
22
10
  return Reflect.get(target, property, receiver);
23
11
  },
24
12
  });
25
- export const makeTrpcIt = (options) => {
26
- const fixtureIt = makeFixtureIt(options.layer);
27
- const effectTRPC = makeTrpcTester(fixtureIt, options);
28
- return withEffectTRPC(effectTRPC);
29
- };
30
13
  export const makeTrpcHarnessIt = (options) => {
31
- const fixtureIt = makeFixtureIt(options.layer);
32
- const effectTRPC = makeTrpcHarnessTester(fixtureIt, options);
33
- return withEffectTRPC(effectTRPC);
14
+ const { effectApp } = makeEffectIt({
15
+ around: options.around,
16
+ clock: options.clock,
17
+ layer: options.layer,
18
+ makeHarness: (context) => Effect.gen(function* () {
19
+ const services = yield* Effect.context();
20
+ const trpc = makeEffectCallerFactory(options.adapter,
21
+ // CreateCaller is a rest-never function type. The option and
22
+ // result aliases are the factory TypeScript cannot recover here.
23
+ options.createCaller, services);
24
+ return yield* options.makeHarness(trpc, context);
25
+ }),
26
+ });
27
+ return withEffectTRPC(effectApp);
34
28
  };
29
+ export const makeTrpcIt = (options) => makeTrpcHarnessIt({
30
+ ...options,
31
+ makeHarness: (trpc) => Effect.succeed(trpc),
32
+ });
35
33
  //# sourceMappingURL=vitest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.js","sourceRoot":"","sources":["../../src/testing/vitest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,QAAQ,EAAe,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAEN,WAAW,EACX,qBAAqB,EACrB,cAAc,GACd,MAAM,4BAA4B,CAAC;AAUpC,MAAM,aAAa,GAAG,CACrB,KAAwC,EACb,EAAE,CAC7B,QAAQ,CAAC,MAAM,CACd,WAAW,EACX,EAAE,KAAK,EAAE,QAAQ,EAAE;AACnB,0GAA0G;AAC1G,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,E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A6D;YAC7D,iEAAiE;YACjE,OAAO,CAAC,YAAwD,EAChE,QAAQ,CACR,CAAC;YACF,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC;KACH,CAAC,CAAC;IAEH,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAKzB,OAAmD,EAKlD,EAAE,CACH,iBAAiB,CAAC;IACjB,GAAG,OAAO;IACV,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;CAC3C,CAIA,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/effect-trpc",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Effect-native procedures and testing for tRPC",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -42,10 +42,13 @@
42
42
  "access": "public",
43
43
  "provenance": true
44
44
  },
45
+ "dependencies": {
46
+ "@shivaedev/effect-test": "0.1.0"
47
+ },
45
48
  "peerDependencies": {
46
- "@effect/vitest": "4.0.0-beta.107",
49
+ "@effect/vitest": "4.0.0-rc.108",
47
50
  "@trpc/server": "11.18.0",
48
- "effect": "4.0.0-beta.107"
51
+ "effect": "4.0.0-rc.108"
49
52
  },
50
53
  "peerDependenciesMeta": {
51
54
  "@effect/vitest": {
@@ -53,11 +56,11 @@
53
56
  }
54
57
  },
55
58
  "devDependencies": {
56
- "@effect/vitest": "4.0.0-beta.107",
59
+ "@effect/vitest": "4.0.0-rc.108",
57
60
  "@trpc/server": "11.18.0",
58
61
  "@types/node": "24.10.1",
59
62
  "@typescript/native": "npm:typescript@7.0.2",
60
- "effect": "4.0.0-beta.107",
63
+ "effect": "4.0.0-rc.108",
61
64
  "typescript": "npm:@typescript/typescript6@6.0.2",
62
65
  "vitest": "4.1.9"
63
66
  },
@@ -1,4 +1,5 @@
1
- import type { TestContext, TestOptions, Vitest } from "@effect/vitest";
1
+ import type { TestContext, Vitest } from "@effect/vitest";
2
+ import type { EffectClock, EffectTestOptions } from "@shivaedev/effect-test";
2
3
  import type { Effect, Layer } from "effect";
3
4
  import type { EffectTRPCAdapter } from "../adapter.js";
4
5
  import type { EffectCallerFactory } from "./caller.js";
@@ -9,7 +10,7 @@ export type TrpcHarnessTest<Harness, Provided> = <
9
10
  >(
10
11
  name: string,
11
12
  body: (harness: Harness, context: TestContext) => Generator<Eff, A, never>,
12
- options?: number | TestOptions,
13
+ options?: number | EffectTestOptions,
13
14
  ) => void;
14
15
 
15
16
  export interface TrpcHarnessTester<Harness, Provided>
@@ -27,7 +28,7 @@ export interface TrpcHarnessTester<Harness, Provided>
27
28
  harness: Harness,
28
29
  context: TestContext,
29
30
  ) => Generator<Eff, A, never>,
30
- options?: number | TestOptions,
31
+ options?: number | EffectTestOptions,
31
32
  ) => void;
32
33
  readonly fails: TrpcHarnessTest<Harness, Provided>;
33
34
  }
@@ -50,41 +51,6 @@ export type TrpcHarnessIt<Harness, Provided> = Vitest.Methods & {
50
51
  readonly effectTRPC: TrpcHarnessTester<Harness, Provided>;
51
52
  };
52
53
 
53
- export interface TrpcHarnessTestRuntimeOptions<
54
- Options,
55
- Caller extends object,
56
- Harness,
57
- Provided,
58
- LayerError,
59
- > {
60
- readonly adapter: Pick<EffectTRPCAdapter<never>, "runWithServices">;
61
- readonly around?: <A, E>(
62
- effect: Effect.Effect<A, E, Provided>,
63
- ) => Effect.Effect<A, unknown, Provided>;
64
- readonly createCaller: (options?: Options) => Caller;
65
- readonly layer: Layer.Layer<Provided, LayerError>;
66
- readonly makeHarness: (
67
- trpc: EffectCallerFactory<Options, Caller>,
68
- context: TestContext,
69
- ) => Effect.Effect<Harness, unknown, Provided>;
70
- }
71
-
72
- export type TrpcTestRuntimeOptions<
73
- Options,
74
- Caller extends object,
75
- Provided,
76
- LayerError,
77
- > = Omit<
78
- TrpcHarnessTestRuntimeOptions<
79
- Options,
80
- Caller,
81
- EffectCallerFactory<Options, Caller>,
82
- Provided,
83
- LayerError
84
- >,
85
- "makeHarness"
86
- >;
87
-
88
54
  export interface MakeTrpcItOptions<
89
55
  CreateCaller extends (...arguments_: never[]) => object,
90
56
  // biome-ignore lint/suspicious/noExplicitAny: Layer output and error are recovered with Layer utility types
@@ -94,6 +60,7 @@ export interface MakeTrpcItOptions<
94
60
  readonly around?: <A, E>(
95
61
  effect: Effect.Effect<A, E, Layer.Success<TestLayer>>,
96
62
  ) => Effect.Effect<A, unknown, Layer.Success<TestLayer>>;
63
+ readonly clock?: EffectClock;
97
64
  readonly createCaller: CreateCaller;
98
65
  readonly layer: TestLayer;
99
66
  }
@@ -1,11 +1,7 @@
1
1
  import { it as effectIt, type Vitest } from "@effect/vitest";
2
- import { Effect, Exit, Layer, Scope } from "effect";
3
- import {
4
- type FixtureTestApi,
5
- fixtureName,
6
- makeTrpcHarnessTester,
7
- makeTrpcTester,
8
- } from "../internal/vitest-trpc.js";
2
+ import { makeEffectIt } from "@shivaedev/effect-test";
3
+ import { Effect, type Layer } from "effect";
4
+ import { makeEffectCallerFactory } from "./caller.js";
9
5
  import type {
10
6
  CallerOptions,
11
7
  CallerResult,
@@ -15,26 +11,6 @@ import type {
15
11
  TrpcIt,
16
12
  } from "./types.js";
17
13
 
18
- const makeFixtureIt = <Provided, LayerError>(
19
- layer: Layer.Layer<Provided, LayerError>,
20
- ): FixtureTestApi<Provided> =>
21
- effectIt.extend(
22
- fixtureName,
23
- { scope: "worker" },
24
- // biome-ignore lint/correctness/noEmptyPattern: Vitest fixtures require a destructured context parameter.
25
- async ({}, { onCleanup }) => {
26
- const scope = Effect.runSync(Scope.make());
27
- onCleanup(() => Effect.runPromise(Scope.close(scope, Exit.void)));
28
-
29
- try {
30
- return await Effect.runPromise(Layer.buildWithScope(layer, scope));
31
- } catch (error) {
32
- await Effect.runPromise(Scope.close(scope, Exit.void));
33
- throw error;
34
- }
35
- },
36
- ) as unknown as FixtureTestApi<Provided>;
37
-
38
14
  const withEffectTRPC = <Tester>(
39
15
  tester: Tester,
40
16
  ): Vitest.Methods & {
@@ -49,62 +25,55 @@ const withEffectTRPC = <Tester>(
49
25
  },
50
26
  }) as Vitest.Methods & { readonly effectTRPC: Tester };
51
27
 
52
- export const makeTrpcIt = <
28
+ export const makeTrpcHarnessIt = <
53
29
  CreateCaller extends (...arguments_: never[]) => object,
54
30
  // biome-ignore lint/suspicious/noExplicitAny: Layer output and error are recovered with Layer utility types
55
31
  TestLayer extends Layer.Layer<any, any, never>,
32
+ Harness,
56
33
  >(
57
- options: MakeTrpcItOptions<CreateCaller, TestLayer>,
58
- ): TrpcIt<
59
- CallerOptions<CreateCaller>,
60
- CallerResult<CreateCaller>,
61
- Layer.Success<TestLayer>
62
- > => {
34
+ options: MakeTrpcHarnessItOptions<CreateCaller, TestLayer, Harness>,
35
+ ): TrpcHarnessIt<Harness, Layer.Success<TestLayer>> => {
63
36
  type Options = CallerOptions<CreateCaller>;
64
37
  type Caller = CallerResult<CreateCaller>;
65
38
  type Provided = Layer.Success<TestLayer>;
66
39
 
67
- const fixtureIt = makeFixtureIt<Provided, Layer.Error<TestLayer>>(
68
- options.layer,
69
- );
40
+ const { effectApp } = makeEffectIt({
41
+ around: options.around,
42
+ clock: options.clock,
43
+ layer: options.layer,
44
+ makeHarness: (context) =>
45
+ Effect.gen(function* () {
46
+ const services = yield* Effect.context<Provided>();
47
+ const trpc = makeEffectCallerFactory(
48
+ options.adapter,
49
+ // CreateCaller is a rest-never function type. The option and
50
+ // result aliases are the factory TypeScript cannot recover here.
51
+ options.createCaller as unknown as (options?: Options) => Caller,
52
+ services,
53
+ );
54
+ return yield* options.makeHarness(trpc, context);
55
+ }),
56
+ });
70
57
 
71
- const effectTRPC = makeTrpcTester(
72
- fixtureIt as unknown as FixtureTestApi<Provided>,
73
- options as unknown as Parameters<
74
- typeof makeTrpcTester<Options, Caller, Provided, Layer.Error<TestLayer>>
75
- >[1],
76
- );
77
-
78
- return withEffectTRPC(effectTRPC) as TrpcIt<Options, Caller, Provided>;
58
+ return withEffectTRPC(effectApp);
79
59
  };
80
60
 
81
- export const makeTrpcHarnessIt = <
61
+ export const makeTrpcIt = <
82
62
  CreateCaller extends (...arguments_: never[]) => object,
83
63
  // biome-ignore lint/suspicious/noExplicitAny: Layer output and error are recovered with Layer utility types
84
64
  TestLayer extends Layer.Layer<any, any, never>,
85
- Harness,
86
65
  >(
87
- options: MakeTrpcHarnessItOptions<CreateCaller, TestLayer, Harness>,
88
- ): TrpcHarnessIt<Harness, Layer.Success<TestLayer>> => {
89
- type Options = CallerOptions<CreateCaller>;
90
- type Caller = CallerResult<CreateCaller>;
91
- type Provided = Layer.Success<TestLayer>;
92
-
93
- const fixtureIt = makeFixtureIt<Provided, Layer.Error<TestLayer>>(
94
- options.layer,
95
- );
96
- const effectTRPC = makeTrpcHarnessTester(
97
- fixtureIt,
98
- options as unknown as Parameters<
99
- typeof makeTrpcHarnessTester<
100
- Options,
101
- Caller,
102
- Harness,
103
- Provided,
104
- Layer.Error<TestLayer>
105
- >
106
- >[1],
107
- );
108
-
109
- return withEffectTRPC(effectTRPC);
110
- };
66
+ options: MakeTrpcItOptions<CreateCaller, TestLayer>,
67
+ ): TrpcIt<
68
+ CallerOptions<CreateCaller>,
69
+ CallerResult<CreateCaller>,
70
+ Layer.Success<TestLayer>
71
+ > =>
72
+ makeTrpcHarnessIt({
73
+ ...options,
74
+ makeHarness: (trpc) => Effect.succeed(trpc),
75
+ }) as TrpcIt<
76
+ CallerOptions<CreateCaller>,
77
+ CallerResult<CreateCaller>,
78
+ Layer.Success<TestLayer>
79
+ >;
@@ -1,19 +0,0 @@
1
- import type { TestContext, TestOptions } from "@effect/vitest";
2
- import { type Context } from "effect";
3
- import type { TrpcHarnessTester, TrpcHarnessTestRuntimeOptions, TrpcTester, TrpcTestRuntimeOptions } from "../testing/types.js";
4
- export declare const fixtureName = "__effectTrpcContext";
5
- export type TrpcFixture<Provided> = TestContext & {
6
- readonly [fixtureName]: Context.Context<Provided>;
7
- };
8
- export interface FixtureTestApi<Provided> {
9
- (name: string, options: TestOptions, body: (context: TrpcFixture<Provided>) => Promise<unknown>): void;
10
- readonly skip: FixtureTestApi<Provided>;
11
- readonly skipIf: (condition: unknown) => FixtureTestApi<Provided>;
12
- readonly runIf: (condition: unknown) => FixtureTestApi<Provided>;
13
- readonly only: FixtureTestApi<Provided>;
14
- readonly fails: FixtureTestApi<Provided>;
15
- readonly for: <Item>(cases: ReadonlyArray<Item>) => (name: string, options: TestOptions, body: (item: Item, context: TrpcFixture<Provided>) => Promise<unknown>) => void;
16
- }
17
- export declare const makeTrpcHarnessTester: <Options, Caller extends object, Harness, Provided, LayerError>(fixtureIt: FixtureTestApi<Provided>, options: TrpcHarnessTestRuntimeOptions<Options, Caller, Harness, Provided, LayerError>) => TrpcHarnessTester<Harness, Provided>;
18
- export declare const makeTrpcTester: <Options, Caller extends object, Provided, LayerError>(fixtureIt: FixtureTestApi<Provided>, options: TrpcTestRuntimeOptions<Options, Caller, Provided, LayerError>) => TrpcTester<Options, Caller, Provided>;
19
- //# sourceMappingURL=vitest-trpc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest-trpc.d.ts","sourceRoot":"","sources":["../../src/internal/vitest-trpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAS,KAAK,OAAO,EAAmC,MAAM,QAAQ,CAAC;AAI9E,OAAO,KAAK,EAEX,iBAAiB,EACjB,6BAA6B,EAC7B,UAAU,EACV,sBAAsB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,WAAW,wBAAwB,CAAC;AAEjD,MAAM,MAAM,WAAW,CAAC,QAAQ,IAAI,WAAW,GAAG;IACjD,QAAQ,CAAC,CAAC,WAAW,CAAC,EAAE,OAAO,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B,QAAQ,EACR,UAAU,EAEV,WAAW,cAAc,CAAC,QAAQ,CAAC,EACnC,SAAS,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,KACpE,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAIK,CAAC"}
@@ -1,75 +0,0 @@
1
- import { Cause, Effect, Exit, Layer } from "effect";
2
- import * as TestClock from "effect/testing/TestClock";
3
- import * as TestConsole from "effect/testing/TestConsole";
4
- import { makeEffectCallerFactory } from "../testing/caller.js";
5
- export const fixtureName = "__effectTrpcContext";
6
- const TestEnvironment = Layer.mergeAll(TestConsole.layer, TestClock.layer());
7
- const normalizeTestOptions = (options) => typeof options === "number" ? { timeout: options } : (options ?? {});
8
- const restoreContext = (fixture, context) => ({ ...context, [fixtureName]: fixture });
9
- const contextFrom = (context) => context[fixtureName];
10
- const runEffectTest = (effect, context) => Effect.runPromise(Effect.gen(function* () {
11
- const exit = yield* Effect.exit(effect);
12
- if (Exit.isFailure(exit)) {
13
- for (const error of Cause.prettyErrors(exit.cause)) {
14
- yield* Effect.logError(error);
15
- }
16
- }
17
- return yield* exit;
18
- }).pipe(Effect.scoped, Effect.provide(TestEnvironment)), { signal: context.signal });
19
- export const makeTrpcHarnessTester = (fixtureIt, options) => {
20
- const run = (body, context) => {
21
- const program = Effect.gen(function* () {
22
- const services = yield* Effect.context();
23
- const trpc = makeEffectCallerFactory(options.adapter, options.createCaller, services);
24
- const harness = yield* options.makeHarness(trpc, context);
25
- return yield* Effect.gen(() => body(harness, context));
26
- });
27
- // The body constraint proves every yielded service is part of Provided.
28
- // TypeScript cannot reduce that generic generator requirement here.
29
- const ready = program;
30
- const wrapped = options.around?.(ready) ?? ready;
31
- return wrapped.pipe(Effect.provide(contextFrom(context)));
32
- };
33
- const register = (current) => (name, body, testOptions) => current(name, normalizeTestOptions(testOptions), ({ __effectTrpcContext, task, signal, onTestFailed, onTestFinished, skip, annotate, expect, _local, }) => {
34
- const context = restoreContext(__effectTrpcContext, {
35
- task,
36
- signal,
37
- onTestFailed,
38
- onTestFinished,
39
- skip,
40
- annotate,
41
- expect,
42
- _local,
43
- });
44
- return runEffectTest(run(body, context), context);
45
- });
46
- const make = (current) => {
47
- const test = register(current);
48
- return Object.assign(test, {
49
- skip: register(current.skip),
50
- skipIf: (condition) => register(current.skipIf(condition)),
51
- runIf: (condition) => register(current.runIf(condition)),
52
- only: register(current.only),
53
- each: (cases) => (name, body, testOptions) => fixtureIt.for(cases)(name, normalizeTestOptions(testOptions), (item, { __effectTrpcContext, task, signal, onTestFailed, onTestFinished, skip, annotate, expect, _local, }) => {
54
- const context = restoreContext(__effectTrpcContext, {
55
- task,
56
- signal,
57
- onTestFailed,
58
- onTestFinished,
59
- skip,
60
- annotate,
61
- expect,
62
- _local,
63
- });
64
- return runEffectTest(run((harness, testContext) => body(item, harness, testContext), context), context);
65
- }),
66
- fails: register(current.fails),
67
- });
68
- };
69
- return make(fixtureIt);
70
- };
71
- export const makeTrpcTester = (fixtureIt, options) => makeTrpcHarnessTester(fixtureIt, {
72
- ...options,
73
- makeHarness: (trpc) => Effect.succeed(trpc),
74
- });
75
- //# sourceMappingURL=vitest-trpc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest-trpc.js","sourceRoot":"","sources":["../../src/internal/vitest-trpc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAc,MAAM,QAAQ,CAAC;AAC9E,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,WAAW,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAS/D,MAAM,CAAC,MAAM,WAAW,GAAG,qBAAqB,CAAC;AA0BjD,MAAM,eAAe,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CA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C;YACH,CAAC,CACD;YACH,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;SAC9B,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAM7B,SAAmC,EACnC,OAAsE,EAC9B,EAAE,CAC1C,qBAAqB,CAAC,SAAS,EAAE;IAChC,GAAG,OAAO;IACV,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;CAC3C,CAA0C,CAAC"}
@@ -1,219 +0,0 @@
1
- import type { TestContext, TestOptions } from "@effect/vitest";
2
- import { Cause, type Context, Effect, Exit, Layer, type Scope } from "effect";
3
- import * as TestClock from "effect/testing/TestClock";
4
- import * as TestConsole from "effect/testing/TestConsole";
5
- import { makeEffectCallerFactory } from "../testing/caller.js";
6
- import type {
7
- TrpcHarnessTest,
8
- TrpcHarnessTester,
9
- TrpcHarnessTestRuntimeOptions,
10
- TrpcTester,
11
- TrpcTestRuntimeOptions,
12
- } from "../testing/types.js";
13
-
14
- export const fixtureName = "__effectTrpcContext";
15
-
16
- export type TrpcFixture<Provided> = TestContext & {
17
- readonly [fixtureName]: Context.Context<Provided>;
18
- };
19
-
20
- export interface FixtureTestApi<Provided> {
21
- (
22
- name: string,
23
- options: TestOptions,
24
- body: (context: TrpcFixture<Provided>) => Promise<unknown>,
25
- ): void;
26
- readonly skip: FixtureTestApi<Provided>;
27
- readonly skipIf: (condition: unknown) => FixtureTestApi<Provided>;
28
- readonly runIf: (condition: unknown) => FixtureTestApi<Provided>;
29
- readonly only: FixtureTestApi<Provided>;
30
- readonly fails: FixtureTestApi<Provided>;
31
- readonly for: <Item>(
32
- cases: ReadonlyArray<Item>,
33
- ) => (
34
- name: string,
35
- options: TestOptions,
36
- body: (item: Item, context: TrpcFixture<Provided>) => Promise<unknown>,
37
- ) => void;
38
- }
39
-
40
- const TestEnvironment = Layer.mergeAll(TestConsole.layer, TestClock.layer());
41
-
42
- const normalizeTestOptions = (
43
- options: number | TestOptions | undefined,
44
- ): TestOptions =>
45
- typeof options === "number" ? { timeout: options } : (options ?? {});
46
-
47
- const restoreContext = <Provided>(
48
- fixture: Context.Context<Provided>,
49
- context: Omit<TrpcFixture<Provided>, typeof fixtureName>,
50
- ): TrpcFixture<Provided> =>
51
- ({ ...context, [fixtureName]: fixture }) as TrpcFixture<Provided>;
52
-
53
- const contextFrom = <Provided>(
54
- context: TestContext,
55
- ): Context.Context<Provided> => (context as TrpcFixture<Provided>)[fixtureName];
56
-
57
- const runEffectTest = <A, E>(
58
- effect: Effect.Effect<A, E, Scope.Scope>,
59
- context: TestContext,
60
- ): Promise<A> =>
61
- Effect.runPromise(
62
- Effect.gen(function* () {
63
- const exit = yield* Effect.exit(effect);
64
- if (Exit.isFailure(exit)) {
65
- for (const error of Cause.prettyErrors(exit.cause)) {
66
- yield* Effect.logError(error);
67
- }
68
- }
69
- return yield* exit;
70
- }).pipe(Effect.scoped, Effect.provide(TestEnvironment)),
71
- { signal: context.signal },
72
- );
73
-
74
- export const makeTrpcHarnessTester = <
75
- Options,
76
- Caller extends object,
77
- Harness,
78
- Provided,
79
- LayerError,
80
- >(
81
- fixtureIt: FixtureTestApi<Provided>,
82
- options: TrpcHarnessTestRuntimeOptions<
83
- Options,
84
- Caller,
85
- Harness,
86
- Provided,
87
- LayerError
88
- >,
89
- ): TrpcHarnessTester<Harness, Provided> => {
90
- const run = <A, Eff extends Effect.Effect<unknown, unknown, Provided>>(
91
- body: (harness: Harness, context: TestContext) => Generator<Eff, A, never>,
92
- context: TestContext,
93
- ): Effect.Effect<A, unknown, Scope.Scope> => {
94
- const program = Effect.gen(function* () {
95
- const services = yield* Effect.context<Provided>();
96
- const trpc = makeEffectCallerFactory(
97
- options.adapter,
98
- options.createCaller,
99
- services,
100
- );
101
- const harness = yield* options.makeHarness(trpc, context);
102
- return yield* Effect.gen(() => body(harness, context));
103
- });
104
- // The body constraint proves every yielded service is part of Provided.
105
- // TypeScript cannot reduce that generic generator requirement here.
106
- const ready = program as Effect.Effect<A, unknown, Provided>;
107
- const wrapped = options.around?.(ready) ?? ready;
108
- return wrapped.pipe(
109
- Effect.provide(contextFrom<Provided>(context)),
110
- ) as Effect.Effect<A, unknown, Scope.Scope>;
111
- };
112
-
113
- const register =
114
- (current: FixtureTestApi<Provided>): TrpcHarnessTest<Harness, Provided> =>
115
- (name, body, testOptions) =>
116
- current(
117
- name,
118
- normalizeTestOptions(testOptions),
119
- ({
120
- __effectTrpcContext,
121
- task,
122
- signal,
123
- onTestFailed,
124
- onTestFinished,
125
- skip,
126
- annotate,
127
- expect,
128
- _local,
129
- }: TrpcFixture<Provided>) => {
130
- const context = restoreContext(__effectTrpcContext, {
131
- task,
132
- signal,
133
- onTestFailed,
134
- onTestFinished,
135
- skip,
136
- annotate,
137
- expect,
138
- _local,
139
- });
140
- return runEffectTest(run(body, context), context);
141
- },
142
- );
143
-
144
- const make = (
145
- current: FixtureTestApi<Provided>,
146
- ): TrpcHarnessTester<Harness, Provided> => {
147
- const test = register(current);
148
- return Object.assign(test, {
149
- skip: register(current.skip),
150
- skipIf: (condition: unknown) => register(current.skipIf(condition)),
151
- runIf: (condition: unknown) => register(current.runIf(condition)),
152
- only: register(current.only),
153
- each:
154
- <Item>(cases: ReadonlyArray<Item>) =>
155
- <A, Eff extends Effect.Effect<unknown, unknown, Provided>>(
156
- name: string,
157
- body: (
158
- item: Item,
159
- harness: Harness,
160
- context: TestContext,
161
- ) => Generator<Eff, A, never>,
162
- testOptions?: number | TestOptions,
163
- ) =>
164
- fixtureIt.for(cases)(
165
- name,
166
- normalizeTestOptions(testOptions),
167
- (
168
- item,
169
- {
170
- __effectTrpcContext,
171
- task,
172
- signal,
173
- onTestFailed,
174
- onTestFinished,
175
- skip,
176
- annotate,
177
- expect,
178
- _local,
179
- }: TrpcFixture<Provided>,
180
- ) => {
181
- const context = restoreContext(__effectTrpcContext, {
182
- task,
183
- signal,
184
- onTestFailed,
185
- onTestFinished,
186
- skip,
187
- annotate,
188
- expect,
189
- _local,
190
- });
191
- return runEffectTest(
192
- run(
193
- (harness, testContext) => body(item, harness, testContext),
194
- context,
195
- ),
196
- context,
197
- );
198
- },
199
- ),
200
- fails: register(current.fails),
201
- });
202
- };
203
-
204
- return make(fixtureIt);
205
- };
206
-
207
- export const makeTrpcTester = <
208
- Options,
209
- Caller extends object,
210
- Provided,
211
- LayerError,
212
- >(
213
- fixtureIt: FixtureTestApi<Provided>,
214
- options: TrpcTestRuntimeOptions<Options, Caller, Provided, LayerError>,
215
- ): TrpcTester<Options, Caller, Provided> =>
216
- makeTrpcHarnessTester(fixtureIt, {
217
- ...options,
218
- makeHarness: (trpc) => Effect.succeed(trpc),
219
- }) as TrpcTester<Options, Caller, Provided>;