@jterrazz/test 6.0.0 → 6.1.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/chunk.cjs +28 -0
- package/dist/index.cjs +46 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -12
- package/dist/index.d.ts +14 -12
- package/dist/index.js +41 -18
- package/dist/index.js.map +1 -1
- package/dist/mock-of.cjs +2 -29
- package/dist/mock-of.cjs.map +1 -1
- package/dist/services.cjs +4 -3
- package/dist/services.d.cts +2 -2
- package/dist/services.d.ts +2 -2
- package/dist/services.js +2 -2
- package/dist/{redis.adapter.cjs → sqlite.adapter.cjs} +119 -2
- package/dist/sqlite.adapter.cjs.map +1 -0
- package/dist/{redis.adapter.d.ts → sqlite.adapter.d.cts} +56 -2
- package/dist/{redis.adapter.d.cts → sqlite.adapter.d.ts} +56 -2
- package/dist/{redis.adapter.js → sqlite.adapter.js} +113 -3
- package/dist/sqlite.adapter.js.map +1 -0
- package/package.json +3 -1
- package/dist/redis.adapter.cjs.map +0 -1
- package/dist/redis.adapter.js.map +0 -1
package/dist/chunk.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
Object.defineProperty(exports, "__toESM", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return __toESM;
|
|
27
|
+
}
|
|
28
|
+
});
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./chunk.cjs");
|
|
3
|
+
const require_sqlite_adapter = require("./sqlite.adapter.cjs");
|
|
2
4
|
const require_mock_of = require("./mock-of.cjs");
|
|
3
|
-
const require_redis_adapter = require("./redis.adapter.cjs");
|
|
4
5
|
let node_child_process = require("node:child_process");
|
|
5
6
|
let node_fs = require("node:fs");
|
|
6
7
|
let node_os = require("node:os");
|
|
@@ -1211,7 +1212,13 @@ var Orchestrator = class {
|
|
|
1211
1212
|
const composePath = findComposeFile(this.root);
|
|
1212
1213
|
const composeDir = composePath ? (0, node_path.dirname)(composePath) : this.root;
|
|
1213
1214
|
const composeConfig = composePath ? parseComposeFile(composePath) : null;
|
|
1214
|
-
const
|
|
1215
|
+
const containerServices = [];
|
|
1216
|
+
const embeddedServices = [];
|
|
1217
|
+
for (const handle of this.services) {
|
|
1218
|
+
if (handle.defaultPort === 0) {
|
|
1219
|
+
embeddedServices.push(handle);
|
|
1220
|
+
continue;
|
|
1221
|
+
}
|
|
1215
1222
|
let image = handle.defaultImage;
|
|
1216
1223
|
let env = { ...handle.environment };
|
|
1217
1224
|
if (handle.composeName && composeConfig) {
|
|
@@ -1225,18 +1232,26 @@ var Orchestrator = class {
|
|
|
1225
1232
|
Object.assign(handle.environment, composeService.environment);
|
|
1226
1233
|
}
|
|
1227
1234
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1235
|
+
const container = new TestcontainersAdapter({
|
|
1236
|
+
image,
|
|
1237
|
+
port: handle.defaultPort,
|
|
1238
|
+
env
|
|
1239
|
+
});
|
|
1240
|
+
containerServices.push({
|
|
1241
|
+
container,
|
|
1234
1242
|
handle
|
|
1235
|
-
};
|
|
1236
|
-
}
|
|
1237
|
-
await Promise.all(
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
await Promise.all([...containerServices.map(({ container }) => container.start()), ...embeddedServices.map(async (handle) => {
|
|
1246
|
+
await handle.initialize(composeDir);
|
|
1247
|
+
handle.started = true;
|
|
1248
|
+
this.running.push({
|
|
1249
|
+
handle,
|
|
1250
|
+
container: null
|
|
1251
|
+
});
|
|
1252
|
+
})]);
|
|
1238
1253
|
const reports = [];
|
|
1239
|
-
for (const { container, handle } of
|
|
1254
|
+
for (const { container, handle } of containerServices) {
|
|
1240
1255
|
const serviceStartTime = Date.now();
|
|
1241
1256
|
try {
|
|
1242
1257
|
const host = container.getHost();
|
|
@@ -1302,7 +1317,7 @@ var Orchestrator = class {
|
|
|
1302
1317
|
for (const service of composeConfig.infraServices) {
|
|
1303
1318
|
const type = detectServiceType(service.image);
|
|
1304
1319
|
if (type === "postgres") {
|
|
1305
|
-
const handle =
|
|
1320
|
+
const handle = require_sqlite_adapter.postgres({
|
|
1306
1321
|
compose: service.name,
|
|
1307
1322
|
env: service.environment
|
|
1308
1323
|
});
|
|
@@ -1312,7 +1327,7 @@ var Orchestrator = class {
|
|
|
1312
1327
|
handle.started = true;
|
|
1313
1328
|
this.composeHandles.push(handle);
|
|
1314
1329
|
} else if (type === "redis") {
|
|
1315
|
-
const handle =
|
|
1330
|
+
const handle = require_sqlite_adapter.redis({ compose: service.name });
|
|
1316
1331
|
const port = this.composeStack.getMappedPort(service.name, 6379);
|
|
1317
1332
|
handle.connectionString = handle.buildConnectionString("localhost", port);
|
|
1318
1333
|
handle.started = true;
|
|
@@ -1450,7 +1465,12 @@ async function startApp(target, options) {
|
|
|
1450
1465
|
});
|
|
1451
1466
|
await orchestrator.start();
|
|
1452
1467
|
await acquireIsolation(services);
|
|
1453
|
-
const
|
|
1468
|
+
const servicesMap = {};
|
|
1469
|
+
for (const svc of services) {
|
|
1470
|
+
const key = svc.composeName ?? svc.type;
|
|
1471
|
+
servicesMap[key] = svc;
|
|
1472
|
+
}
|
|
1473
|
+
const honoApp = target.factory(servicesMap);
|
|
1454
1474
|
const database = orchestrator.getDatabase() ?? void 0;
|
|
1455
1475
|
const databases = orchestrator.getDatabases();
|
|
1456
1476
|
const runner = createSpecificationRunner({
|
|
@@ -1526,13 +1546,17 @@ async function startCommand(target, options) {
|
|
|
1526
1546
|
//#endregion
|
|
1527
1547
|
//#region src/runner/targets.ts
|
|
1528
1548
|
/**
|
|
1529
|
-
* Test against an in-process Hono app.
|
|
1530
|
-
*
|
|
1549
|
+
* Test against an in-process Hono app. The factory receives started services
|
|
1550
|
+
* so you can wire connection strings into your app/DI container.
|
|
1531
1551
|
*
|
|
1532
|
-
* @param factory - Function that returns a Hono app instance
|
|
1552
|
+
* @param factory - Function that receives services and returns a Hono app instance.
|
|
1533
1553
|
*
|
|
1534
1554
|
* @example
|
|
1535
|
-
*
|
|
1555
|
+
* const db = postgres({ compose: 'db' });
|
|
1556
|
+
* await spec(
|
|
1557
|
+
* app((services) => createApp({ databaseUrl: services.db.connectionString })),
|
|
1558
|
+
* { services: [db] },
|
|
1559
|
+
* );
|
|
1536
1560
|
*/
|
|
1537
1561
|
function app(factory) {
|
|
1538
1562
|
return {
|
|
@@ -1677,9 +1701,10 @@ exports.integration = integration;
|
|
|
1677
1701
|
exports.mockOf = require_mock_of.mockOf;
|
|
1678
1702
|
exports.mockOfDate = require_mock_of.mockOfDate;
|
|
1679
1703
|
exports.normalizeOutput = normalizeOutput;
|
|
1680
|
-
exports.postgres =
|
|
1681
|
-
exports.redis =
|
|
1704
|
+
exports.postgres = require_sqlite_adapter.postgres;
|
|
1705
|
+
exports.redis = require_sqlite_adapter.redis;
|
|
1682
1706
|
exports.spec = spec;
|
|
1707
|
+
exports.sqlite = require_sqlite_adapter.sqlite;
|
|
1683
1708
|
exports.stack = stack;
|
|
1684
1709
|
exports.stripAnsi = stripAnsi;
|
|
1685
1710
|
|