@noego/testing 0.7.5 → 0.7.6

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/dist/index.js CHANGED
@@ -1289,6 +1289,12 @@ function assertTestLanes(required, reports) {
1289
1289
  }
1290
1290
 
1291
1291
  // src/overlays.ts
1292
+ import { defineModule, flattenModule as flattenModule2 } from "@noego/ioc";
1293
+ function admittedClassBinding(token2) {
1294
+ return flattenModule2(defineModule("@noego/testing/admitted", (bind) => {
1295
+ bind(token2).toSelf();
1296
+ }))[0];
1297
+ }
1292
1298
  var TestOverlayError = class extends Error {
1293
1299
  constructor(message, entry) {
1294
1300
  super("entry " + entry.provenance.join(".") + ": " + message);
@@ -1330,7 +1336,7 @@ function resolveTestOverlays(stub, catalogs) {
1330
1336
  if (candidates.length === 0 && entry.kind !== "middleware" && entry.kind !== "load" && (typeof entry.target === "function" || entry.kind === "value")) {
1331
1337
  const fallback = catalogs.filter((c) => entry.owner === void 0 || c.owner === entry.owner);
1332
1338
  if (fallback.length === 1) {
1333
- const synthetic = typeof entry.target === "function" ? { token: entry.target, kind: "class", lifetime: "singleton", implementation: entry.target, dependencies: [] } : { token: entry.target, kind: "value", lifetime: "singleton", implementation: entry.replacement, dependencies: [] };
1339
+ const synthetic = typeof entry.target === "function" ? admittedClassBinding(entry.target) : { token: entry.target, kind: "value", lifetime: "singleton", implementation: entry.replacement, dependencies: [] };
1334
1340
  candidates = [{ ...fallback[0], bindings: [...fallback[0].bindings, synthetic] }];
1335
1341
  }
1336
1342
  }
@@ -1352,7 +1358,7 @@ function resolveTestOverlays(stub, catalogs) {
1352
1358
  }
1353
1359
 
1354
1360
  // src/binding_overlays.ts
1355
- import { defineModule } from "@noego/ioc";
1361
+ import { defineModule as defineModule2 } from "@noego/ioc";
1356
1362
  function applyTestBindings(production, overlays, owner) {
1357
1363
  let builder = production;
1358
1364
  const entries = overlays.filter((e) => e.owner === owner);
@@ -1361,7 +1367,7 @@ function applyTestBindings(production, overlays, owner) {
1361
1367
  const { entry, binding: binding2 } = overlay;
1362
1368
  if (entry.kind === "middleware" || entry.kind === "load" || entry.kind === "method") continue;
1363
1369
  if (!binding2) throw new TestOverlayError("missing production binding metadata", entry);
1364
- builder = builder.use(defineModule("@noego/testing/" + owner + "/" + entry.provenance.join("."), (bind) => {
1370
+ builder = builder.use(defineModule2("@noego/testing/" + owner + "/" + entry.provenance.join("."), (bind) => {
1365
1371
  if (entry.kind === "class") {
1366
1372
  bind(entry.target).to(entry.replacement)[binding2.lifetime]();
1367
1373
  } else if (entry.kind === "function" && binding2.kind === "factory") {
@@ -1426,15 +1432,15 @@ function createTestExecutables(overlays, owner) {
1426
1432
  }
1427
1433
 
1428
1434
  // src/binding_catalog.ts
1429
- import { defineModule as defineModule2, flattenModule as flattenModule2 } from "@noego/ioc";
1435
+ import { defineModule as defineModule3, flattenModule as flattenModule3 } from "@noego/ioc";
1430
1436
  function describeTestBindings(builder, discovered = []) {
1431
1437
  const declarations = /* @__PURE__ */ new Map();
1432
- const classBinding = (token2, implementation) => flattenModule2(defineModule2("@noego/testing/discovered", (bind) => {
1438
+ const classBinding = (token2, implementation) => flattenModule3(defineModule3("@noego/testing/discovered", (bind) => {
1433
1439
  bind(token2).to(implementation);
1434
1440
  }))[0];
1435
1441
  for (const write of builder.writes) {
1436
1442
  if (write.op === "use") {
1437
- for (const registration of flattenModule2(write.module)) declarations.set(registration.token, registration);
1443
+ for (const registration of flattenModule3(write.module)) declarations.set(registration.token, registration);
1438
1444
  } else if (write.op === "classes") {
1439
1445
  const registration = classBinding(write.key, write.implementation);
1440
1446
  declarations.set(write.key, { ...registration, lifetime: declarations.get(write.key)?.lifetime ?? registration.lifetime });