@noego/testing 0.7.5 → 0.7.7-dev.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.
- package/dist/index.cjs +12 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/package.json +8 -5
package/dist/index.cjs
CHANGED
|
@@ -1344,6 +1344,12 @@ function assertTestLanes(required, reports) {
|
|
|
1344
1344
|
}
|
|
1345
1345
|
|
|
1346
1346
|
// src/overlays.ts
|
|
1347
|
+
var import_ioc3 = require("@noego/ioc");
|
|
1348
|
+
function admittedClassBinding(token2) {
|
|
1349
|
+
return (0, import_ioc3.flattenModule)((0, import_ioc3.defineModule)("@noego/testing/admitted", (bind) => {
|
|
1350
|
+
bind(token2).toSelf();
|
|
1351
|
+
}))[0];
|
|
1352
|
+
}
|
|
1347
1353
|
var TestOverlayError = class extends Error {
|
|
1348
1354
|
constructor(message, entry) {
|
|
1349
1355
|
super("entry " + entry.provenance.join(".") + ": " + message);
|
|
@@ -1385,7 +1391,7 @@ function resolveTestOverlays(stub, catalogs) {
|
|
|
1385
1391
|
if (candidates.length === 0 && entry.kind !== "middleware" && entry.kind !== "load" && (typeof entry.target === "function" || entry.kind === "value")) {
|
|
1386
1392
|
const fallback = catalogs.filter((c) => entry.owner === void 0 || c.owner === entry.owner);
|
|
1387
1393
|
if (fallback.length === 1) {
|
|
1388
|
-
const synthetic = typeof entry.target === "function" ?
|
|
1394
|
+
const synthetic = typeof entry.target === "function" ? admittedClassBinding(entry.target) : { token: entry.target, kind: "value", lifetime: "singleton", implementation: entry.replacement, dependencies: [] };
|
|
1389
1395
|
candidates = [{ ...fallback[0], bindings: [...fallback[0].bindings, synthetic] }];
|
|
1390
1396
|
}
|
|
1391
1397
|
}
|
|
@@ -1407,7 +1413,7 @@ function resolveTestOverlays(stub, catalogs) {
|
|
|
1407
1413
|
}
|
|
1408
1414
|
|
|
1409
1415
|
// src/binding_overlays.ts
|
|
1410
|
-
var
|
|
1416
|
+
var import_ioc4 = require("@noego/ioc");
|
|
1411
1417
|
function applyTestBindings(production, overlays, owner) {
|
|
1412
1418
|
let builder = production;
|
|
1413
1419
|
const entries = overlays.filter((e) => e.owner === owner);
|
|
@@ -1416,7 +1422,7 @@ function applyTestBindings(production, overlays, owner) {
|
|
|
1416
1422
|
const { entry, binding: binding2 } = overlay;
|
|
1417
1423
|
if (entry.kind === "middleware" || entry.kind === "load" || entry.kind === "method") continue;
|
|
1418
1424
|
if (!binding2) throw new TestOverlayError("missing production binding metadata", entry);
|
|
1419
|
-
builder = builder.use((0,
|
|
1425
|
+
builder = builder.use((0, import_ioc4.defineModule)("@noego/testing/" + owner + "/" + entry.provenance.join("."), (bind) => {
|
|
1420
1426
|
if (entry.kind === "class") {
|
|
1421
1427
|
bind(entry.target).to(entry.replacement)[binding2.lifetime]();
|
|
1422
1428
|
} else if (entry.kind === "function" && binding2.kind === "factory") {
|
|
@@ -1481,15 +1487,15 @@ function createTestExecutables(overlays, owner) {
|
|
|
1481
1487
|
}
|
|
1482
1488
|
|
|
1483
1489
|
// src/binding_catalog.ts
|
|
1484
|
-
var
|
|
1490
|
+
var import_ioc5 = require("@noego/ioc");
|
|
1485
1491
|
function describeTestBindings(builder, discovered = []) {
|
|
1486
1492
|
const declarations = /* @__PURE__ */ new Map();
|
|
1487
|
-
const classBinding = (token2, implementation) => (0,
|
|
1493
|
+
const classBinding = (token2, implementation) => (0, import_ioc5.flattenModule)((0, import_ioc5.defineModule)("@noego/testing/discovered", (bind) => {
|
|
1488
1494
|
bind(token2).to(implementation);
|
|
1489
1495
|
}))[0];
|
|
1490
1496
|
for (const write of builder.writes) {
|
|
1491
1497
|
if (write.op === "use") {
|
|
1492
|
-
for (const registration of (0,
|
|
1498
|
+
for (const registration of (0, import_ioc5.flattenModule)(write.module)) declarations.set(registration.token, registration);
|
|
1493
1499
|
} else if (write.op === "classes") {
|
|
1494
1500
|
const registration = classBinding(write.key, write.implementation);
|
|
1495
1501
|
declarations.set(write.key, { ...registration, lifetime: declarations.get(write.key)?.lifetime ?? registration.lifetime });
|