@lunora/testing 1.0.0-alpha.2 → 1.0.0-alpha.200
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/LICENSE.md +6 -0
- package/README.md +20 -2
- package/__assets__/package-og.svg +1 -1
- package/dist/index.d.mts +667 -177
- package/dist/index.d.ts +667 -177
- package/dist/index.mjs +1 -2
- package/dist/packem_shared/agentHarness-DA9onGVO.mjs +1 -0
- package/dist/packem_shared/containsScorer-DoLfFOs6.mjs +2 -0
- package/dist/packem_shared/evaluationAttributes-CYLgTP1P.mjs +1 -0
- package/dist/packem_shared/groundednessScorer-kgXJCZDg.mjs +3 -0
- package/dist/packem_shared/lunoraTest-mzzCbiQ3.mjs +1 -0
- package/dist/playwright.d.mts +126 -0
- package/dist/playwright.d.ts +126 -0
- package/dist/playwright.mjs +1 -0
- package/package.json +20 -5
- package/dist/packem_shared/lunoraTest-BUg4Ebv8.mjs +0 -415
package/LICENSE.md
CHANGED
|
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -116,6 +116,18 @@ const t = lunoraTest(schema, { fetch: fakeFetch });
|
|
|
116
116
|
|
|
117
117
|
Without the option, `ctx.fetch` still throws the v1 error on first access.
|
|
118
118
|
|
|
119
|
+
#### Fixed `ctx.now`
|
|
120
|
+
|
|
121
|
+
Pass a `now` option (epoch ms) to pin `ctx.now` across every context, so
|
|
122
|
+
time-dependent handlers are deterministic:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
const t = lunoraTest(schema, { now: 1_700_000_000_000 });
|
|
126
|
+
// ctx.now === 1_700_000_000_000 in every query/mutation/action
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Defaults to the wall clock captured at harness creation.
|
|
130
|
+
|
|
119
131
|
#### Controllable in-memory scheduler
|
|
120
132
|
|
|
121
133
|
`ctx.scheduler` is a fully functional fake. Jobs are enqueued synchronously but
|
|
@@ -155,8 +167,14 @@ The virtual clock is **per-harness** — advancing one harness's clock does not
|
|
|
155
167
|
affect other harnesses, so tests running in parallel are isolated.
|
|
156
168
|
|
|
157
169
|
Provide a `functions` map (`{ "path:name": registeredFn }`) so the scheduler
|
|
158
|
-
can dispatch jobs.
|
|
159
|
-
|
|
170
|
+
can dispatch jobs. A path not in the map fails the job with `FUNCTION_NOT_FOUND`,
|
|
171
|
+
which then walks the retry budget into `t.scheduler.failures()` — matching
|
|
172
|
+
production, where the DO fires the job at the Worker and dead-letters it.
|
|
173
|
+
|
|
174
|
+
A retryable failure is re-enqueued silently, so `failures()` only fills once the
|
|
175
|
+
whole backoff schedule (~930s of virtual clock) has elapsed — and at that point
|
|
176
|
+
`advance()`/`runPending()` re-throw the failure by default. Pass
|
|
177
|
+
`{ throwOnError: false }` to inspect `failures()` instead.
|
|
160
178
|
|
|
161
179
|
#### Subscription testing
|
|
162
180
|
|