@logixjs/test 0.0.1 → 1.0.0

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.
Files changed (44) hide show
  1. package/LICENSE +201 -0
  2. package/dist/Act-65bCRtuC.d.cts +31 -0
  3. package/dist/Act-65bCRtuC.d.ts +31 -0
  4. package/dist/Act.cjs +91 -0
  5. package/dist/Act.d.cts +3 -0
  6. package/dist/Act.d.ts +3 -0
  7. package/dist/Act.js +15 -0
  8. package/dist/{Assertions-uDVCBadW.d.cts → Assertions-CzVzJ0dQ.d.cts} +1 -1
  9. package/dist/{Assertions-OpNAhiI_.d.ts → Assertions-D2zfasOD.d.ts} +1 -1
  10. package/dist/Assertions.cjs +3 -2
  11. package/dist/Assertions.d.cts +3 -2
  12. package/dist/Assertions.d.ts +3 -2
  13. package/dist/Assertions.js +2 -2
  14. package/dist/{TestProgram-BLXiWhJQ.d.cts → TestProgram-BNm-06UK.d.cts} +4 -3
  15. package/dist/{TestProgram-CPvVAbfI.d.cts → TestProgram-DHhYdhOm.d.cts} +1 -1
  16. package/dist/{TestProgram-X35n_2Js.d.ts → TestProgram-DolBjSUH.d.ts} +4 -3
  17. package/dist/{TestProgram-DJAm0dIS.d.ts → TestProgram-zI8wr33R.d.ts} +1 -1
  18. package/dist/TestProgram.cjs +28 -31
  19. package/dist/TestProgram.d.cts +3 -2
  20. package/dist/TestProgram.d.ts +3 -2
  21. package/dist/TestProgram.js +3 -3
  22. package/dist/TestRuntime.cjs +2 -1
  23. package/dist/TestRuntime.js +2 -2
  24. package/dist/{Vitest-BiBMIx3C.d.cts → Vitest-2U7CpZsz.d.cts} +1 -1
  25. package/dist/{Vitest-BXBtxem-.d.ts → Vitest-Dr3jUgWl.d.ts} +1 -1
  26. package/dist/Vitest.cjs +30 -32
  27. package/dist/Vitest.d.cts +4 -3
  28. package/dist/Vitest.d.ts +4 -3
  29. package/dist/Vitest.js +4 -4
  30. package/dist/{chunk-CZJ37XWT.js → chunk-3XOKB7L4.js} +25 -29
  31. package/dist/{chunk-DU6VSL4D.js → chunk-5I2BFXGD.js} +3 -2
  32. package/dist/chunk-AJNVZ6GR.js +66 -0
  33. package/dist/{chunk-WVD5DTP4.js → chunk-CRWKRQEB.js} +1 -1
  34. package/dist/{chunk-5XFEOVH5.js → chunk-JX3RZZWB.js} +1 -1
  35. package/dist/{chunk-DKT5EFOF.js → chunk-OO3UZI3U.js} +3 -2
  36. package/dist/{chunk-42QGM623.js → chunk-PPQRMDUV.js} +1 -1
  37. package/dist/{chunk-TDYES47J.js → chunk-SP6DKYGN.js} +2 -2
  38. package/dist/index.cjs +86 -32
  39. package/dist/index.d.cts +7 -5
  40. package/dist/index.d.ts +7 -5
  41. package/dist/index.js +11 -7
  42. package/dist/{waitUntil-CjpwZxCu.d.cts → waitUntil-CZQDLJ7j.d.cts} +3 -2
  43. package/dist/{waitUntil-CjpwZxCu.d.ts → waitUntil-CZQDLJ7j.d.ts} +3 -2
  44. package/package.json +12 -6
@@ -1,6 +1,7 @@
1
- export { T as TestApi, a as TestProgramOptions, r as runProgram } from './TestProgram-X35n_2Js.js';
1
+ export { T as TestApi, a as TestProgramOptions, r as runProgram } from './TestProgram-DolBjSUH.js';
2
2
  import 'effect';
3
3
  import '@logixjs/core';
4
4
  import '@logixjs/core/Runtime';
5
5
  import './ExecutionResult-BRC-Jzsv.js';
6
- import './waitUntil-CjpwZxCu.js';
6
+ import 'effect/testing';
7
+ import './waitUntil-CZQDLJ7j.js';
@@ -1,8 +1,8 @@
1
- import "./chunk-5XFEOVH5.js";
1
+ import "./chunk-JX3RZZWB.js";
2
2
  import {
3
3
  runProgram
4
- } from "./chunk-CZJ37XWT.js";
5
- import "./chunk-DU6VSL4D.js";
4
+ } from "./chunk-3XOKB7L4.js";
5
+ import "./chunk-5I2BFXGD.js";
6
6
  import "./chunk-RG24KSEB.js";
7
7
  import "./chunk-FOYMJMJR.js";
8
8
  export {
@@ -26,8 +26,9 @@ module.exports = __toCommonJS(TestRuntime_exports);
26
26
 
27
27
  // src/internal/runtime/runTest.ts
28
28
  var import_effect = require("effect");
29
+ var import_testing = require("effect/testing");
29
30
  var runTest = (effect) => {
30
- const program = import_effect.Effect.scoped(effect).pipe(import_effect.Effect.provide(import_effect.TestContext.TestContext));
31
+ const program = import_effect.Effect.scoped(effect).pipe(import_effect.Effect.provide(import_testing.TestClock.layer()));
31
32
  return import_effect.Effect.runPromise(program);
32
33
  };
33
34
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
- import "./chunk-42QGM623.js";
1
+ import "./chunk-PPQRMDUV.js";
2
2
  import {
3
3
  runTest
4
- } from "./chunk-DKT5EFOF.js";
4
+ } from "./chunk-OO3UZI3U.js";
5
5
  import "./chunk-FOYMJMJR.js";
6
6
  export {
7
7
  runTest
@@ -1,7 +1,7 @@
1
1
  import { Effect } from 'effect';
2
2
  import * as Logix from '@logixjs/core';
3
3
  import { E as ExecutionResult } from './ExecutionResult-BRC-Jzsv.cjs';
4
- import { T as TestApi, a as TestProgramOptions } from './TestProgram-BLXiWhJQ.cjs';
4
+ import { T as TestApi, a as TestProgramOptions } from './TestProgram-BNm-06UK.cjs';
5
5
 
6
6
  /**
7
7
  * Sugar: defines a program test based on `TestProgram.runProgram`.
@@ -1,7 +1,7 @@
1
1
  import { Effect } from 'effect';
2
2
  import * as Logix from '@logixjs/core';
3
3
  import { E as ExecutionResult } from './ExecutionResult-BRC-Jzsv.js';
4
- import { T as TestApi, a as TestProgramOptions } from './TestProgram-X35n_2Js.js';
4
+ import { T as TestApi, a as TestProgramOptions } from './TestProgram-DolBjSUH.js';
5
5
 
6
6
  /**
7
7
  * Sugar: defines a program test based on `TestProgram.runProgram`.
package/dist/Vitest.cjs CHANGED
@@ -3117,13 +3117,15 @@ var expectNoError = (result) => {
3117
3117
 
3118
3118
  // src/internal/runtime/runTest.ts
3119
3119
  var import_effect = require("effect");
3120
+ var import_testing = require("effect/testing");
3120
3121
  var runTest = (effect) => {
3121
- const program = import_effect.Effect.scoped(effect).pipe(import_effect.Effect.provide(import_effect.TestContext.TestContext));
3122
+ const program = import_effect.Effect.scoped(effect).pipe(import_effect.Effect.provide(import_testing.TestClock.layer()));
3122
3123
  return import_effect.Effect.runPromise(program);
3123
3124
  };
3124
3125
 
3125
3126
  // src/internal/api/TestProgram.ts
3126
3127
  var import_effect4 = require("effect");
3128
+ var import_testing3 = require("effect/testing");
3127
3129
  var Logix = __toESM(require("@logixjs/core"), 1);
3128
3130
 
3129
3131
  // src/internal/utils/assertions.ts
@@ -3162,6 +3164,7 @@ var assertSignal = (actual, expectedType, expectedPayload) => {
3162
3164
 
3163
3165
  // src/internal/utils/waitUntil.ts
3164
3166
  var import_effect3 = require("effect");
3167
+ var import_testing2 = require("effect/testing");
3165
3168
  var waitUntil = (check, options = {}) => import_effect3.Effect.gen(function* () {
3166
3169
  const maxAttempts = options.maxAttempts ?? 20;
3167
3170
  const step = options.step ?? "10 millis";
@@ -3172,8 +3175,8 @@ var waitUntil = (check, options = {}) => import_effect3.Effect.gen(function* ()
3172
3175
  return result.value;
3173
3176
  }
3174
3177
  lastError = result.cause;
3175
- yield* import_effect3.TestClock.adjust(step);
3176
- yield* import_effect3.Effect.yieldNow();
3178
+ yield* import_testing2.TestClock.adjust(step);
3179
+ yield* import_effect3.Effect.yieldNow;
3177
3180
  }
3178
3181
  return yield* import_effect3.Effect.fail(lastError);
3179
3182
  });
@@ -3182,7 +3185,7 @@ var waitUntil = (check, options = {}) => import_effect3.Effect.gen(function* ()
3182
3185
  var defaultOptions = (options) => {
3183
3186
  const base = options ?? {};
3184
3187
  const userLayer = base.layer ?? import_effect4.Layer.empty;
3185
- const layer = import_effect4.Layer.mergeAll(import_effect4.TestContext.TestContext, userLayer);
3188
+ const layer = import_effect4.Layer.mergeAll(import_testing3.TestClock.layer(), userLayer);
3186
3189
  return {
3187
3190
  ...base,
3188
3191
  layer,
@@ -3214,7 +3217,7 @@ var makeTestApi = (ctx, actionsRef) => {
3214
3217
  return {
3215
3218
  ctx,
3216
3219
  dispatch: ctx.module.dispatch,
3217
- advance: (duration) => import_effect4.TestClock.adjust(duration).pipe(import_effect4.Effect.asVoid),
3220
+ advance: (duration) => import_testing3.TestClock.adjust(duration).pipe(import_effect4.Effect.asVoid),
3218
3221
  assert: {
3219
3222
  state: assertStateEffect,
3220
3223
  signal: assertSignalEffect
@@ -3230,7 +3233,7 @@ var startTraceCollectors = (ctx, traceRef, actionsRef) => import_effect4.Effect.
3230
3233
  yield* import_effect4.Ref.update(traceRef, import_effect4.Chunk.append(event));
3231
3234
  yield* import_effect4.Ref.update(actionsRef, import_effect4.Chunk.append(action));
3232
3235
  })
3233
- ).pipe(import_effect4.Effect.forkScoped, import_effect4.Scope.extend(ctx.scope));
3236
+ ).pipe((effect) => import_effect4.Effect.forkIn(effect, ctx.scope), import_effect4.Effect.asVoid);
3234
3237
  yield* import_effect4.Stream.runForEach(
3235
3238
  ctx.module.changes((s) => s),
3236
3239
  (state) => import_effect4.Effect.gen(function* () {
@@ -3238,10 +3241,14 @@ var startTraceCollectors = (ctx, traceRef, actionsRef) => import_effect4.Effect.
3238
3241
  const event = { _tag: "State", state, timestamp };
3239
3242
  yield* import_effect4.Ref.update(traceRef, import_effect4.Chunk.append(event));
3240
3243
  })
3241
- ).pipe(import_effect4.Effect.forkScoped, import_effect4.Scope.extend(ctx.scope));
3242
- yield* import_effect4.TestClock.adjust(1);
3243
- yield* import_effect4.Effect.yieldNow();
3244
+ ).pipe((effect) => import_effect4.Effect.forkIn(effect, ctx.scope), import_effect4.Effect.asVoid);
3245
+ yield* import_testing3.TestClock.adjust(1);
3246
+ yield* import_effect4.Effect.yieldNow;
3244
3247
  });
3248
+ var runInProgramScope = (ctx, effect) => import_effect4.Effect.tryPromise({
3249
+ try: () => ctx.runtime.runPromise(import_effect4.Effect.provideService(effect, import_effect4.Scope.Scope, ctx.scope)),
3250
+ catch: (e) => e
3251
+ }).pipe(import_effect4.Effect.orDie);
3245
3252
  var runProgram = (program, body, options) => import_effect4.Effect.gen(function* () {
3246
3253
  const traceRef = yield* import_effect4.Ref.make(import_effect4.Chunk.empty());
3247
3254
  const actionsRef = yield* import_effect4.Ref.make(import_effect4.Chunk.empty());
@@ -3262,31 +3269,22 @@ var runProgram = (program, body, options) => import_effect4.Effect.gen(function*
3262
3269
  }
3263
3270
  };
3264
3271
  const resolved = defaultOptions(options);
3265
- const ctx = yield* import_effect4.Effect.locally(Logix.Debug.internal.currentDebugSinks, [debugSink])(
3266
- Logix.Runtime.openProgram(program, resolved)
3272
+ const ctx = yield* import_effect4.Effect.provideService(
3273
+ Logix.Runtime.openProgram(program, resolved),
3274
+ Logix.Debug.internal.currentDebugSinks,
3275
+ [debugSink]
3267
3276
  );
3268
- yield* import_effect4.Effect.tryPromise({
3269
- try: () => ctx.runtime.runPromise(startTraceCollectors(ctx, traceRef, actionsRef)),
3270
- catch: (e) => e
3271
- }).pipe(import_effect4.Effect.orDie);
3277
+ yield* runInProgramScope(ctx, startTraceCollectors(ctx, traceRef, actionsRef));
3272
3278
  const api = makeTestApi(ctx, actionsRef);
3273
- yield* import_effect4.Effect.tryPromise({
3274
- try: () => ctx.runtime.runPromise(body(api).pipe(import_effect4.Scope.extend(ctx.scope))),
3275
- catch: (e) => e
3276
- }).pipe(import_effect4.Effect.orDie);
3277
- yield* import_effect4.Effect.tryPromise({
3278
- try: () => ctx.runtime.runPromise(
3279
- import_effect4.Effect.gen(function* () {
3280
- yield* import_effect4.TestClock.adjust(1);
3281
- yield* import_effect4.Effect.yieldNow();
3282
- })
3283
- ),
3284
- catch: (e) => e
3285
- }).pipe(import_effect4.Effect.orDie);
3286
- const finalState = yield* import_effect4.Effect.tryPromise({
3287
- try: () => ctx.runtime.runPromise(ctx.module.getState),
3288
- catch: (e) => e
3289
- }).pipe(import_effect4.Effect.orDie);
3279
+ yield* runInProgramScope(ctx, body(api));
3280
+ yield* runInProgramScope(
3281
+ ctx,
3282
+ import_effect4.Effect.gen(function* () {
3283
+ yield* import_testing3.TestClock.adjust(1);
3284
+ yield* import_effect4.Effect.yieldNow;
3285
+ })
3286
+ );
3287
+ const finalState = yield* runInProgramScope(ctx, ctx.module.getState);
3290
3288
  const actionsChunk = yield* import_effect4.Ref.get(actionsRef);
3291
3289
  const traceChunk = yield* import_effect4.Ref.get(traceRef);
3292
3290
  return make(
package/dist/Vitest.d.cts CHANGED
@@ -1,7 +1,8 @@
1
- export { i as itProgram, a as itProgramResult } from './Vitest-BiBMIx3C.cjs';
1
+ export { i as itProgram, a as itProgramResult } from './Vitest-2U7CpZsz.cjs';
2
2
  import 'effect';
3
3
  import '@logixjs/core';
4
4
  import './ExecutionResult-BRC-Jzsv.cjs';
5
- import './TestProgram-BLXiWhJQ.cjs';
5
+ import './TestProgram-BNm-06UK.cjs';
6
6
  import '@logixjs/core/Runtime';
7
- import './waitUntil-CjpwZxCu.cjs';
7
+ import 'effect/testing';
8
+ import './waitUntil-CZQDLJ7j.cjs';
package/dist/Vitest.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export { i as itProgram, a as itProgramResult } from './Vitest-BXBtxem-.js';
1
+ export { i as itProgram, a as itProgramResult } from './Vitest-Dr3jUgWl.js';
2
2
  import 'effect';
3
3
  import '@logixjs/core';
4
4
  import './ExecutionResult-BRC-Jzsv.js';
5
- import './TestProgram-X35n_2Js.js';
5
+ import './TestProgram-DolBjSUH.js';
6
6
  import '@logixjs/core/Runtime';
7
- import './waitUntil-CjpwZxCu.js';
7
+ import 'effect/testing';
8
+ import './waitUntil-CZQDLJ7j.js';
package/dist/Vitest.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  itProgram,
3
3
  itProgramResult
4
- } from "./chunk-TDYES47J.js";
5
- import "./chunk-CZJ37XWT.js";
6
- import "./chunk-DU6VSL4D.js";
4
+ } from "./chunk-SP6DKYGN.js";
5
+ import "./chunk-3XOKB7L4.js";
6
+ import "./chunk-5I2BFXGD.js";
7
7
  import "./chunk-RG24KSEB.js";
8
- import "./chunk-DKT5EFOF.js";
8
+ import "./chunk-OO3UZI3U.js";
9
9
  import "./chunk-FOYMJMJR.js";
10
10
  export {
11
11
  itProgram,
@@ -2,18 +2,19 @@ import {
2
2
  assertSignal,
3
3
  assertState,
4
4
  waitUntil
5
- } from "./chunk-DU6VSL4D.js";
5
+ } from "./chunk-5I2BFXGD.js";
6
6
  import {
7
7
  make
8
8
  } from "./chunk-RG24KSEB.js";
9
9
 
10
10
  // src/internal/api/TestProgram.ts
11
- import { Chunk, Clock, Effect, Layer, Ref, Scope, Stream, TestClock, TestContext } from "effect";
11
+ import { Chunk, Clock, Effect, Layer, Ref, Scope, Stream } from "effect";
12
+ import { TestClock } from "effect/testing";
12
13
  import * as Logix from "@logixjs/core";
13
14
  var defaultOptions = (options) => {
14
15
  const base = options ?? {};
15
16
  const userLayer = base.layer ?? Layer.empty;
16
- const layer = Layer.mergeAll(TestContext.TestContext, userLayer);
17
+ const layer = Layer.mergeAll(TestClock.layer(), userLayer);
17
18
  return {
18
19
  ...base,
19
20
  layer,
@@ -61,7 +62,7 @@ var startTraceCollectors = (ctx, traceRef, actionsRef) => Effect.gen(function* (
61
62
  yield* Ref.update(traceRef, Chunk.append(event));
62
63
  yield* Ref.update(actionsRef, Chunk.append(action));
63
64
  })
64
- ).pipe(Effect.forkScoped, Scope.extend(ctx.scope));
65
+ ).pipe((effect) => Effect.forkIn(effect, ctx.scope), Effect.asVoid);
65
66
  yield* Stream.runForEach(
66
67
  ctx.module.changes((s) => s),
67
68
  (state) => Effect.gen(function* () {
@@ -69,10 +70,14 @@ var startTraceCollectors = (ctx, traceRef, actionsRef) => Effect.gen(function* (
69
70
  const event = { _tag: "State", state, timestamp };
70
71
  yield* Ref.update(traceRef, Chunk.append(event));
71
72
  })
72
- ).pipe(Effect.forkScoped, Scope.extend(ctx.scope));
73
+ ).pipe((effect) => Effect.forkIn(effect, ctx.scope), Effect.asVoid);
73
74
  yield* TestClock.adjust(1);
74
- yield* Effect.yieldNow();
75
+ yield* Effect.yieldNow;
75
76
  });
77
+ var runInProgramScope = (ctx, effect) => Effect.tryPromise({
78
+ try: () => ctx.runtime.runPromise(Effect.provideService(effect, Scope.Scope, ctx.scope)),
79
+ catch: (e) => e
80
+ }).pipe(Effect.orDie);
76
81
  var runProgram = (program, body, options) => Effect.gen(function* () {
77
82
  const traceRef = yield* Ref.make(Chunk.empty());
78
83
  const actionsRef = yield* Ref.make(Chunk.empty());
@@ -93,31 +98,22 @@ var runProgram = (program, body, options) => Effect.gen(function* () {
93
98
  }
94
99
  };
95
100
  const resolved = defaultOptions(options);
96
- const ctx = yield* Effect.locally(Logix.Debug.internal.currentDebugSinks, [debugSink])(
97
- Logix.Runtime.openProgram(program, resolved)
101
+ const ctx = yield* Effect.provideService(
102
+ Logix.Runtime.openProgram(program, resolved),
103
+ Logix.Debug.internal.currentDebugSinks,
104
+ [debugSink]
98
105
  );
99
- yield* Effect.tryPromise({
100
- try: () => ctx.runtime.runPromise(startTraceCollectors(ctx, traceRef, actionsRef)),
101
- catch: (e) => e
102
- }).pipe(Effect.orDie);
106
+ yield* runInProgramScope(ctx, startTraceCollectors(ctx, traceRef, actionsRef));
103
107
  const api = makeTestApi(ctx, actionsRef);
104
- yield* Effect.tryPromise({
105
- try: () => ctx.runtime.runPromise(body(api).pipe(Scope.extend(ctx.scope))),
106
- catch: (e) => e
107
- }).pipe(Effect.orDie);
108
- yield* Effect.tryPromise({
109
- try: () => ctx.runtime.runPromise(
110
- Effect.gen(function* () {
111
- yield* TestClock.adjust(1);
112
- yield* Effect.yieldNow();
113
- })
114
- ),
115
- catch: (e) => e
116
- }).pipe(Effect.orDie);
117
- const finalState = yield* Effect.tryPromise({
118
- try: () => ctx.runtime.runPromise(ctx.module.getState),
119
- catch: (e) => e
120
- }).pipe(Effect.orDie);
108
+ yield* runInProgramScope(ctx, body(api));
109
+ yield* runInProgramScope(
110
+ ctx,
111
+ Effect.gen(function* () {
112
+ yield* TestClock.adjust(1);
113
+ yield* Effect.yieldNow;
114
+ })
115
+ );
116
+ const finalState = yield* runInProgramScope(ctx, ctx.module.getState);
121
117
  const actionsChunk = yield* Ref.get(actionsRef);
122
118
  const traceChunk = yield* Ref.get(traceRef);
123
119
  return make(
@@ -33,7 +33,8 @@ var assertSignal = (actual, expectedType, expectedPayload) => {
33
33
  };
34
34
 
35
35
  // src/internal/utils/waitUntil.ts
36
- import { Effect as Effect2, TestClock } from "effect";
36
+ import { Effect as Effect2 } from "effect";
37
+ import { TestClock } from "effect/testing";
37
38
  var waitUntil = (check, options = {}) => Effect2.gen(function* () {
38
39
  const maxAttempts = options.maxAttempts ?? 20;
39
40
  const step = options.step ?? "10 millis";
@@ -45,7 +46,7 @@ var waitUntil = (check, options = {}) => Effect2.gen(function* () {
45
46
  }
46
47
  lastError = result.cause;
47
48
  yield* TestClock.adjust(step);
48
- yield* Effect2.yieldNow();
49
+ yield* Effect2.yieldNow;
49
50
  }
50
51
  return yield* Effect2.fail(lastError);
51
52
  });
@@ -0,0 +1,66 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-FOYMJMJR.js";
4
+
5
+ // src/Act.ts
6
+ var Act_exports = {};
7
+ __export(Act_exports, {
8
+ advanceTicks: () => advanceTicks,
9
+ flushAllHostScheduler: () => flushAllHostScheduler,
10
+ makeTestHostScheduler: () => makeTestHostScheduler,
11
+ testHostSchedulerLayer: () => testHostSchedulerLayer,
12
+ tickSchedulerTestLayer: () => tickSchedulerTestLayer
13
+ });
14
+ import { Effect } from "effect";
15
+ import * as Logix from "@logixjs/core";
16
+ var makeTestHostScheduler = () => Logix.InternalContracts.makeDeterministicHostScheduler();
17
+ var testHostSchedulerLayer = (scheduler) => Logix.InternalContracts.hostSchedulerTestLayer(scheduler);
18
+ var tickSchedulerTestLayer = (config) => Logix.InternalContracts.tickSchedulerTestLayer(config);
19
+ var flushAllHostScheduler = (scheduler, options) => Effect.gen(function* () {
20
+ const maxTurns = options?.maxTurns ?? 1e3;
21
+ const settleYields = options?.settleYields ?? 8;
22
+ for (let turn = 0; turn < maxTurns; turn += 1) {
23
+ yield* Effect.sync(() => {
24
+ scheduler.flushAll({ maxTurns });
25
+ });
26
+ yield* Effect.yieldNow;
27
+ const { microtasks: microtasks2, macrotasks: macrotasks2 } = scheduler.getQueueSize();
28
+ if (microtasks2 !== 0 || macrotasks2 !== 0) {
29
+ continue;
30
+ }
31
+ for (let i = 0; i < settleYields; i += 1) {
32
+ yield* Effect.yieldNow;
33
+ }
34
+ const after = scheduler.getQueueSize();
35
+ if (after.microtasks === 0 && after.macrotasks === 0) {
36
+ return;
37
+ }
38
+ }
39
+ const { microtasks, macrotasks } = scheduler.getQueueSize();
40
+ throw new Error(
41
+ `[LogixTest.Act.flushAllHostScheduler] Exceeded maxTurns=${maxTurns} (microtasks=${microtasks}, macrotasks=${macrotasks}).`
42
+ );
43
+ }).pipe(Effect.asVoid);
44
+ var advanceTicks = (args) => Effect.gen(function* () {
45
+ const start = args.getTickSeq();
46
+ const expected = start + Math.max(0, args.n);
47
+ const maxTurns = args.maxTurns ?? 1e3;
48
+ for (let turn = 0; turn < maxTurns; turn += 1) {
49
+ yield* flushAllHostScheduler(args.scheduler, { maxTurns });
50
+ const current = args.getTickSeq();
51
+ if (current >= expected) {
52
+ return;
53
+ }
54
+ }
55
+ const end = args.getTickSeq();
56
+ throw new Error(`[LogixTest.Act.advanceTicks] Expected >=${args.n} ticks, got ${end - start}.`);
57
+ }).pipe(Effect.asVoid);
58
+
59
+ export {
60
+ makeTestHostScheduler,
61
+ testHostSchedulerLayer,
62
+ tickSchedulerTestLayer,
63
+ flushAllHostScheduler,
64
+ advanceTicks,
65
+ Act_exports
66
+ };
@@ -2,7 +2,7 @@ import {
2
2
  assertSignal,
3
3
  assertState,
4
4
  waitUntil
5
- } from "./chunk-DU6VSL4D.js";
5
+ } from "./chunk-5I2BFXGD.js";
6
6
  import {
7
7
  __export
8
8
  } from "./chunk-FOYMJMJR.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runProgram
3
- } from "./chunk-CZJ37XWT.js";
3
+ } from "./chunk-3XOKB7L4.js";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-FOYMJMJR.js";
@@ -1,7 +1,8 @@
1
1
  // src/internal/runtime/runTest.ts
2
- import { Effect, TestContext } from "effect";
2
+ import { Effect } from "effect";
3
+ import { TestClock } from "effect/testing";
3
4
  var runTest = (effect) => {
4
- const program = Effect.scoped(effect).pipe(Effect.provide(TestContext.TestContext));
5
+ const program = Effect.scoped(effect).pipe(Effect.provide(TestClock.layer()));
5
6
  return Effect.runPromise(program);
6
7
  };
7
8
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runTest
3
- } from "./chunk-DKT5EFOF.js";
3
+ } from "./chunk-OO3UZI3U.js";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-FOYMJMJR.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  runProgram
3
- } from "./chunk-CZJ37XWT.js";
3
+ } from "./chunk-3XOKB7L4.js";
4
4
  import {
5
5
  expectNoError
6
6
  } from "./chunk-RG24KSEB.js";
7
7
  import {
8
8
  runTest
9
- } from "./chunk-DKT5EFOF.js";
9
+ } from "./chunk-OO3UZI3U.js";
10
10
  import {
11
11
  __commonJS,
12
12
  __export,