@acmekit/test-utils 2.13.1
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/acmekit-test-runner-utils/bootstrap-app.d.ts +10 -0
- package/dist/acmekit-test-runner-utils/bootstrap-app.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/bootstrap-app.js +113 -0
- package/dist/acmekit-test-runner-utils/bootstrap-app.js.map +1 -0
- package/dist/acmekit-test-runner-utils/clear-instances.d.ts +8 -0
- package/dist/acmekit-test-runner-utils/clear-instances.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/clear-instances.js +14 -0
- package/dist/acmekit-test-runner-utils/clear-instances.js.map +1 -0
- package/dist/acmekit-test-runner-utils/config.d.ts +5 -0
- package/dist/acmekit-test-runner-utils/config.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/config.js +37 -0
- package/dist/acmekit-test-runner-utils/config.js.map +1 -0
- package/dist/acmekit-test-runner-utils/index.d.ts +6 -0
- package/dist/acmekit-test-runner-utils/index.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/index.js +22 -0
- package/dist/acmekit-test-runner-utils/index.js.map +1 -0
- package/dist/acmekit-test-runner-utils/use-db.d.ts +15 -0
- package/dist/acmekit-test-runner-utils/use-db.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/use-db.js +55 -0
- package/dist/acmekit-test-runner-utils/use-db.js.map +1 -0
- package/dist/acmekit-test-runner-utils/utils.d.ts +10 -0
- package/dist/acmekit-test-runner-utils/utils.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/utils.js +25 -0
- package/dist/acmekit-test-runner-utils/utils.js.map +1 -0
- package/dist/acmekit-test-runner-utils/wait-workflow-executions.d.ts +9 -0
- package/dist/acmekit-test-runner-utils/wait-workflow-executions.d.ts.map +1 -0
- package/dist/acmekit-test-runner-utils/wait-workflow-executions.js +34 -0
- package/dist/acmekit-test-runner-utils/wait-workflow-executions.js.map +1 -0
- package/dist/acmekit-test-runner.d.ts +52 -0
- package/dist/acmekit-test-runner.d.ts.map +1 -0
- package/dist/acmekit-test-runner.js +272 -0
- package/dist/acmekit-test-runner.js.map +1 -0
- package/dist/database.d.ts +29 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +245 -0
- package/dist/database.js.map +1 -0
- package/dist/events.d.ts +17 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +161 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/init-modules.d.ts +19 -0
- package/dist/init-modules.d.ts.map +1 -0
- package/dist/init-modules.js +47 -0
- package/dist/init-modules.js.map +1 -0
- package/dist/jest.d.ts +2 -0
- package/dist/jest.d.ts.map +1 -0
- package/dist/jest.js +24 -0
- package/dist/jest.js.map +1 -0
- package/dist/mock-event-bus-service.d.ts +9 -0
- package/dist/mock-event-bus-service.d.ts.map +1 -0
- package/dist/mock-event-bus-service.js +19 -0
- package/dist/mock-event-bus-service.js.map +1 -0
- package/dist/module-test-runner.d.ts +44 -0
- package/dist/module-test-runner.d.ts.map +1 -0
- package/dist/module-test-runner.js +297 -0
- package/dist/module-test-runner.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AcmeKitContainer } from "@acmekit/framework/types";
|
|
2
|
+
export declare function startApp({ cwd, env, }?: {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
env?: Record<any, any>;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
shutdown: () => Promise<void>;
|
|
7
|
+
container: AcmeKitContainer;
|
|
8
|
+
port: number;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=bootstrap-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap-app.d.ts","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/bootstrap-app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAyC3D,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,GAAQ,GACT,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;CAAO,GAAG,OAAO,CAAC;IACzD,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,SAAS,EAAE,gBAAgB,CAAA;IAC3B,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,CAiFD"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.startApp = startApp;
|
|
7
|
+
const logger_1 = require("@acmekit/framework/logger");
|
|
8
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
9
|
+
const express_1 = __importDefault(require("express"));
|
|
10
|
+
const get_port_1 = __importDefault(require("get-port"));
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const utils_2 = require("./utils");
|
|
13
|
+
async function bootstrapApp({ cwd, env = {}, } = {}) {
|
|
14
|
+
const app = (0, express_1.default)();
|
|
15
|
+
(0, utils_2.applyEnvVarsToProcess)(env);
|
|
16
|
+
// Register a health check endpoint
|
|
17
|
+
app.get("/health", (_, res) => {
|
|
18
|
+
res.status(200).send("OK");
|
|
19
|
+
});
|
|
20
|
+
const loaders = require("@acmekit/acmekit/loaders/index").default;
|
|
21
|
+
try {
|
|
22
|
+
const { container, shutdown } = await loaders({
|
|
23
|
+
directory: (0, path_1.resolve)(cwd || process.cwd()),
|
|
24
|
+
expressApp: app,
|
|
25
|
+
});
|
|
26
|
+
const PORT = process.env.PORT ? parseInt(process.env.PORT) : await (0, get_port_1.default)();
|
|
27
|
+
return {
|
|
28
|
+
shutdown,
|
|
29
|
+
container,
|
|
30
|
+
app,
|
|
31
|
+
port: PORT,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
logger_1.logger.error("Error bootstrapping app:", error);
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async function startApp({ cwd, env = {}, } = {}) {
|
|
40
|
+
let expressServer;
|
|
41
|
+
let acmekitShutdown = async () => void 0;
|
|
42
|
+
let container;
|
|
43
|
+
try {
|
|
44
|
+
const { app, port, container: appContainer, shutdown: appShutdown, } = await bootstrapApp({
|
|
45
|
+
cwd,
|
|
46
|
+
env,
|
|
47
|
+
});
|
|
48
|
+
container = appContainer;
|
|
49
|
+
acmekitShutdown = appShutdown;
|
|
50
|
+
const shutdown = async () => {
|
|
51
|
+
try {
|
|
52
|
+
const shutdownPromise = (0, utils_1.promiseAll)([
|
|
53
|
+
expressServer?.shutdown(),
|
|
54
|
+
acmekitShutdown(),
|
|
55
|
+
]);
|
|
56
|
+
await (0, utils_2.execOrTimeout)(shutdownPromise);
|
|
57
|
+
if (typeof global !== "undefined" && global?.gc) {
|
|
58
|
+
global.gc();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
logger_1.logger.error("Error during shutdown:", error);
|
|
63
|
+
try {
|
|
64
|
+
await expressServer?.shutdown();
|
|
65
|
+
await acmekitShutdown();
|
|
66
|
+
}
|
|
67
|
+
catch (cleanupError) {
|
|
68
|
+
logger_1.logger.error("Error during forced cleanup:", cleanupError);
|
|
69
|
+
}
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return await new Promise((resolve, reject) => {
|
|
74
|
+
const server = app
|
|
75
|
+
.listen(port)
|
|
76
|
+
.on("error", async (err) => {
|
|
77
|
+
logger_1.logger.error("Error starting server:", err);
|
|
78
|
+
await shutdown();
|
|
79
|
+
return reject(err);
|
|
80
|
+
})
|
|
81
|
+
.on("listening", () => {
|
|
82
|
+
process.send?.(port);
|
|
83
|
+
resolve({
|
|
84
|
+
shutdown,
|
|
85
|
+
container,
|
|
86
|
+
port,
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
expressServer = utils_1.GracefulShutdownServer.create(server);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
logger_1.logger.error("Error in startApp:", error);
|
|
94
|
+
if (expressServer) {
|
|
95
|
+
try {
|
|
96
|
+
await expressServer.shutdown();
|
|
97
|
+
}
|
|
98
|
+
catch (cleanupError) {
|
|
99
|
+
logger_1.logger.error("Error cleaning up express server:", cleanupError);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (acmekitShutdown) {
|
|
103
|
+
try {
|
|
104
|
+
await acmekitShutdown();
|
|
105
|
+
}
|
|
106
|
+
catch (cleanupError) {
|
|
107
|
+
logger_1.logger.error("Error cleaning up acmekit:", cleanupError);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=bootstrap-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap-app.js","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/bootstrap-app.ts"],"names":[],"mappings":";;;;;AA0CA,4BAwFC;AAlID,sDAAkD;AAElD,oDAA6E;AAC7E,sDAA6B;AAC7B,wDAA8B;AAC9B,+BAA8B;AAC9B,mCAA8D;AAE9D,KAAK,UAAU,YAAY,CAAC,EAC1B,GAAG,EACH,GAAG,GAAG,EAAE,MACoC,EAAE;IAC9C,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAA;IACrB,IAAA,6BAAqB,EAAC,GAAG,CAAC,CAAA;IAE1B,mCAAmC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CAAA;gBAEpB,OAAO,CAAC;oBACN,QAAQ;oBACR,SAAS;oBACT,IAAI;iBACL,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;YAEJ,aAAa,GAAG,8BAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACvD,CAAC,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,eAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAA;QACzC,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC;gBACH,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAA;YAChC,CAAC;YAAC,OAAO,YAAY,EAAE,CAAC;gBACtB,eAAM,CAAC,KAAK,CAAC,mCAAmC,EAAE,YAAY,CAAC,CAAA;YACjE,CAAC;QACH,CAAC;QACD,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC;gBACH,MAAM,eAAe,EAAE,CAAA;YACzB,CAAC;YAAC,OAAO,YAAY,EAAE,CAAC;gBACtB,eAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,YAAY,CAAC,CAAA;YAC1D,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cleanup temporary created resources for the migrations
|
|
3
|
+
* @internal I didnt find a god place to put that, should we eventually add a close function
|
|
4
|
+
* to the planner to handle that part? so that you would do planner.close() and it will handle the cleanup
|
|
5
|
+
* automatically just like we usually do for the classic migrations actions
|
|
6
|
+
*/
|
|
7
|
+
export declare function clearInstances(): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=clear-instances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-instances.d.ts","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/clear-instances.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAsB,cAAc,kBAGnC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearInstances = clearInstances;
|
|
4
|
+
/**
|
|
5
|
+
* cleanup temporary created resources for the migrations
|
|
6
|
+
* @internal I didnt find a god place to put that, should we eventually add a close function
|
|
7
|
+
* to the planner to handle that part? so that you would do planner.close() and it will handle the cleanup
|
|
8
|
+
* automatically just like we usually do for the classic migrations actions
|
|
9
|
+
*/
|
|
10
|
+
async function clearInstances() {
|
|
11
|
+
const { AcmeKitModule } = require("@acmekit/framework/modules-sdk");
|
|
12
|
+
AcmeKitModule.clearInstances();
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=clear-instances.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-instances.js","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/clear-instances.ts"],"names":[],"mappings":";;AAMA,wCAGC;AATD;;;;;GAKG;AACI,KAAK,UAAU,cAAc;IAClC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAA;IACnE,aAAa,CAAC,cAAc,EAAE,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/config.ts"],"names":[],"mappings":"AAMA,wBAAsB,oBAAoB,CACxC,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,iBAwCjD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configLoaderOverride = configLoaderOverride;
|
|
4
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
5
|
+
async function configLoaderOverride(entryDirectory, override) {
|
|
6
|
+
const { configManager } = await import("@acmekit/framework/config");
|
|
7
|
+
const { logger } = await import("@acmekit/framework");
|
|
8
|
+
await (0, utils_1.discoverAndRegisterFeatureFlags)({
|
|
9
|
+
flagDir: entryDirectory,
|
|
10
|
+
projectConfigFlags: {},
|
|
11
|
+
router: utils_1.FeatureFlag,
|
|
12
|
+
logger,
|
|
13
|
+
});
|
|
14
|
+
const { configModule, error } = await (0, utils_1.getConfigFile)(entryDirectory, "acmekit-config");
|
|
15
|
+
if (error) {
|
|
16
|
+
throw new Error(error.message || "Error during config loading");
|
|
17
|
+
}
|
|
18
|
+
configModule.projectConfig.databaseDriverOptions;
|
|
19
|
+
configModule.projectConfig.databaseUrl = override.clientUrl;
|
|
20
|
+
configModule.projectConfig.databaseLogging = !!override.debug;
|
|
21
|
+
configModule.projectConfig.databaseDriverOptions =
|
|
22
|
+
override.clientUrl.includes("localhost")
|
|
23
|
+
? {}
|
|
24
|
+
: {
|
|
25
|
+
connection: {
|
|
26
|
+
ssl: { rejectUnauthorized: false },
|
|
27
|
+
},
|
|
28
|
+
idle_in_transaction_session_timeout: 20000,
|
|
29
|
+
};
|
|
30
|
+
logger.info("Disabling admin as we run integration tests");
|
|
31
|
+
Object.assign(configModule.admin ?? {}, { disable: true });
|
|
32
|
+
configManager.loadConfig({
|
|
33
|
+
projectConfig: configModule,
|
|
34
|
+
baseDir: entryDirectory,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/config.ts"],"names":[],"mappings":";;AAMA,oDA0CC;AAhDD,oDAIiC;AAE1B,KAAK,UAAU,oBAAoB,CACxC,cAAsB,EACtB,QAAgD;IAEhD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAA;IACnE,MAAM,EAAE,MAAM,EAAE,GAAG,MA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AA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./bootstrap-app"), exports);
|
|
18
|
+
__exportStar(require("./clear-instances"), exports);
|
|
19
|
+
__exportStar(require("./config"), exports);
|
|
20
|
+
__exportStar(require("./use-db"), exports);
|
|
21
|
+
__exportStar(require("./utils"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,oDAAiC;AACjC,2CAAwB;AACxB,2CAAwB;AACxB,0CAAuB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AcmeKitAppLoader } from "@acmekit/framework";
|
|
2
|
+
import { Logger, AcmeKitContainer } from "@acmekit/framework/types";
|
|
3
|
+
/**
|
|
4
|
+
* Initiates the database connection
|
|
5
|
+
*/
|
|
6
|
+
export declare function initDb(): Promise<import("knex").Knex<any, any>>;
|
|
7
|
+
/**
|
|
8
|
+
* Migrates the database
|
|
9
|
+
*/
|
|
10
|
+
export declare function migrateDatabase(appLoader: AcmeKitAppLoader): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Syncs links with the databse
|
|
13
|
+
*/
|
|
14
|
+
export declare function syncLinks(appLoader: AcmeKitAppLoader, directory: string, container: AcmeKitContainer, logger: Logger): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=use-db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-db.d.ts","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/use-db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAOnE;;GAEG;AACH,wBAAsB,MAAM,2CAM3B;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,gBAAgB,iBAOhE;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,gBAAgB,EAC3B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,iBAef"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initDb = initDb;
|
|
4
|
+
exports.migrateDatabase = migrateDatabase;
|
|
5
|
+
exports.syncLinks = syncLinks;
|
|
6
|
+
const logger_1 = require("@acmekit/framework/logger");
|
|
7
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
/**
|
|
10
|
+
* Initiates the database connection
|
|
11
|
+
*/
|
|
12
|
+
async function initDb() {
|
|
13
|
+
const { pgConnectionLoader } = await import("@acmekit/framework");
|
|
14
|
+
const pgConnection = await pgConnectionLoader();
|
|
15
|
+
return pgConnection;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Migrates the database
|
|
19
|
+
*/
|
|
20
|
+
async function migrateDatabase(appLoader) {
|
|
21
|
+
try {
|
|
22
|
+
await appLoader.runModulesMigrations();
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
logger_1.logger.error("Something went wrong while running the migrations");
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Syncs links with the databse
|
|
31
|
+
*/
|
|
32
|
+
async function syncLinks(appLoader, directory, container, logger) {
|
|
33
|
+
try {
|
|
34
|
+
await loadCustomLinks(directory, container);
|
|
35
|
+
const planner = await appLoader.getLinksExecutionPlanner();
|
|
36
|
+
const actionPlan = await planner.createPlan();
|
|
37
|
+
actionPlan.forEach((action) => {
|
|
38
|
+
logger.info(`Sync links: "${action.action}" ${action.tableName}`);
|
|
39
|
+
});
|
|
40
|
+
await planner.executePlan(actionPlan);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
logger.error("Something went wrong while syncing links");
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function loadCustomLinks(directory, container) {
|
|
48
|
+
const configModule = container.resolve(utils_1.ContainerRegistrationKeys.CONFIG_MODULE);
|
|
49
|
+
const plugins = await (0, utils_1.getResolvedPlugins)(directory, configModule, true);
|
|
50
|
+
const linksSourcePaths = plugins.map((plugin) => (0, path_1.join)(plugin.resolve, "links"));
|
|
51
|
+
const logger = container.resolve(utils_1.ContainerRegistrationKeys.LOGGER);
|
|
52
|
+
const { LinkLoader } = await import("@acmekit/framework");
|
|
53
|
+
await new LinkLoader(linksSourcePaths, logger).load();
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=use-db.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-db.js","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/use-db.ts"],"names":[],"mappings":";;AAYA,wBAMC;AAKD,0CAOC;AAKD,8BAmBC;AArDD,sDAAkD;AAElD,oDAGiC;AACjC,+BAA2B;AAE3B;;GAEG;AACI,KAAK,UAAU,MAAM;IAC1B,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAEjE,MAAM,YAAY,GAAG,MAAM,kBAAkB,EAAE,CAAA;IAE/C,OAAO,YAAY,CAAA;AACrB,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,eAAe,CAAC,SAA2B;IAC/D,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,oBAAoB,EAAE,CAAA;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAM,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAA;QACjE,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,SAAS,CAC7B,SAA2B,EAC3B,SAAiB,EACjB,SAA2B,EAC3B,MAAc;IAEd,IAAI,CAAC;QACH,MAAM,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAE3C,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,wBAAwB,EAAE,CAAA;QAC1D,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,CAAA;QAC7C,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC,CAAA;QACnE,CAAC,CAAC,CAAA;QACF,MAAM,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;QACxD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,SAAiB,EAAE,SAA2B;IAC3E,MAAM,YAAY,GAAG,SAAS,CAAC,OAAO,CACpC,iCAAyB,CAAC,aAAa,CACxC,CAAA;IACD,MAAM,OAAO,GAAG,MAAM,IAAA,0BAAkB,EAAC,SAAS,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;IACvE,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAC9C,IAAA,WAAI,EAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAC9B,CAAA;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,iCAAyB,CAAC,MAAM,CAAC,CAAA;IAElE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAA;IACzD,MAAM,IAAI,UAAU,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;AACvD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function applyEnvVarsToProcess(env?: Record<any, any>): void;
|
|
2
|
+
/**
|
|
3
|
+
* Execute a function and return a promise that resolves when the function
|
|
4
|
+
* resolves or rejects when the function rejects or the timeout is reached.
|
|
5
|
+
* @param fn - The function to execute.
|
|
6
|
+
* @param timeout - The timeout in milliseconds.
|
|
7
|
+
* @returns A promise that resolves when the function resolves or rejects when the function rejects or the timeout is reached.
|
|
8
|
+
*/
|
|
9
|
+
export declare function execOrTimeout(fn: Promise<any> | (() => Promise<void>), timeout?: number): Promise<any>;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,QAI3D;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EACxC,OAAO,GAAE,MAAa,gBASvB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyEnvVarsToProcess = applyEnvVarsToProcess;
|
|
4
|
+
exports.execOrTimeout = execOrTimeout;
|
|
5
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
6
|
+
function applyEnvVarsToProcess(env) {
|
|
7
|
+
if ((0, utils_1.isObject)(env)) {
|
|
8
|
+
Object.entries(env).forEach(([k, v]) => (process.env[k] = v));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Execute a function and return a promise that resolves when the function
|
|
13
|
+
* resolves or rejects when the function rejects or the timeout is reached.
|
|
14
|
+
* @param fn - The function to execute.
|
|
15
|
+
* @param timeout - The timeout in milliseconds.
|
|
16
|
+
* @returns A promise that resolves when the function resolves or rejects when the function rejects or the timeout is reached.
|
|
17
|
+
*/
|
|
18
|
+
async function execOrTimeout(fn, timeout = 5000) {
|
|
19
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
20
|
+
setTimeout(() => reject(new Error("Timeout")), timeout).unref();
|
|
21
|
+
});
|
|
22
|
+
const fnPromise = typeof fn === "function" ? fn() : fn;
|
|
23
|
+
return Promise.race([fnPromise, timeoutPromise]);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/utils.ts"],"names":[],"mappings":";;AAEA,sDAIC;AASD,sCAWC;AA1BD,oDAAmD;AAEnD,SAAgB,qBAAqB,CAAC,GAAsB;IAC1D,IAAI,IAAA,gBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC/D,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,aAAa,CACjC,EAAwC,EACxC,UAAkB,IAAI;IAEtB,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;QAC/C,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,CAAA;IACjE,CAAC,CAAC,CAAA;IAEF,MAAM,SAAS,GAAG,OAAO,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAEtD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AcmeKitContainer } from "@acmekit/framework/types";
|
|
2
|
+
/**
|
|
3
|
+
* Waits for all workflow executions to finish. When relying on workflows but not necessarily
|
|
4
|
+
* waiting for them to finish, this can be used to ensure that a test is not considered done while background executions are still running and can interfere with the other tests.
|
|
5
|
+
* @param container - The container instance.
|
|
6
|
+
* @returns A promise that resolves when all workflow executions have finished.
|
|
7
|
+
*/
|
|
8
|
+
export declare function waitWorkflowExecutions(container: AcmeKitContainer): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=wait-workflow-executions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-workflow-executions.d.ts","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/wait-workflow-executions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,iBAyBvE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.waitWorkflowExecutions = waitWorkflowExecutions;
|
|
4
|
+
const utils_1 = require("@acmekit/framework/utils");
|
|
5
|
+
/**
|
|
6
|
+
* Waits for all workflow executions to finish. When relying on workflows but not necessarily
|
|
7
|
+
* waiting for them to finish, this can be used to ensure that a test is not considered done while background executions are still running and can interfere with the other tests.
|
|
8
|
+
* @param container - The container instance.
|
|
9
|
+
* @returns A promise that resolves when all workflow executions have finished.
|
|
10
|
+
*/
|
|
11
|
+
async function waitWorkflowExecutions(container) {
|
|
12
|
+
const wfe = container.resolve(utils_1.Modules.WORKFLOW_ENGINE, {
|
|
13
|
+
allowUnregistered: true,
|
|
14
|
+
});
|
|
15
|
+
if (!wfe) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const timeout = setTimeout(() => {
|
|
19
|
+
throw new Error("Timeout waiting for workflow executions to finish");
|
|
20
|
+
}, 60000).unref();
|
|
21
|
+
let waitWorkflowsToFinish = true;
|
|
22
|
+
while (waitWorkflowsToFinish) {
|
|
23
|
+
const executions = await wfe.listWorkflowExecutions({
|
|
24
|
+
state: { $nin: ["not_started", "done", "reverted", "failed"] },
|
|
25
|
+
});
|
|
26
|
+
if (executions.length === 0) {
|
|
27
|
+
waitWorkflowsToFinish = false;
|
|
28
|
+
clearTimeout(timeout);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=wait-workflow-executions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-workflow-executions.js","sourceRoot":"","sources":["../../src/acmekit-test-runner-utils/wait-workflow-executions.ts"],"names":[],"mappings":";;AASA,wDAyBC;AAlCD,oDAAkD;AAGlD;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAAC,SAA2B;IACtE,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,eAAO,CAAC,eAAe,EAAE;QACrD,iBAAiB,EAAE,IAAI;KACxB,CAAC,CAAA;IACF,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAM;IACR,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;IACtE,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAA;IAEjB,IAAI,qBAAqB,GAAG,IAAI,CAAA;IAChC,OAAO,qBAAqB,EAAE,CAAC;QAC7B,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,sBAAsB,CAAC;YAClD,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE;SAC/D,CAAC,CAAA;QAEF,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,qBAAqB,GAAG,KAAK,CAAA;YAC7B,YAAY,CAAC,OAAO,CAAC,CAAA;YACrB,MAAK;QACP,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AcmeKitAppOutput } from "@acmekit/framework/modules-sdk";
|
|
2
|
+
import { AcmeKitContainer } from "@acmekit/framework/types";
|
|
3
|
+
export interface AcmeKitSuiteOptions {
|
|
4
|
+
dbConnection: any;
|
|
5
|
+
getContainer: () => AcmeKitContainer;
|
|
6
|
+
api: any;
|
|
7
|
+
dbUtils: {
|
|
8
|
+
create: (dbName: string) => Promise<void>;
|
|
9
|
+
teardown: (options: {
|
|
10
|
+
schema?: string;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
shutdown: (dbName: string) => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
dbConfig: {
|
|
15
|
+
dbName: string;
|
|
16
|
+
schema: string;
|
|
17
|
+
clientUrl: string;
|
|
18
|
+
};
|
|
19
|
+
getAcmeKitApp: () => AcmeKitAppOutput;
|
|
20
|
+
utils: {
|
|
21
|
+
waitWorkflowExecutions: () => Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface TestRunnerConfig {
|
|
25
|
+
moduleName?: string;
|
|
26
|
+
env?: Record<string, any>;
|
|
27
|
+
dbName?: string;
|
|
28
|
+
acmekitConfigFile?: string;
|
|
29
|
+
disableAutoTeardown?: boolean;
|
|
30
|
+
schema?: string;
|
|
31
|
+
debug?: boolean;
|
|
32
|
+
inApp?: boolean;
|
|
33
|
+
hooks?: {
|
|
34
|
+
beforeServerStart?: (container: AcmeKitContainer) => Promise<void>;
|
|
35
|
+
};
|
|
36
|
+
cwd?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function acmekitIntegrationTestRunner({ moduleName, dbName, acmekitConfigFile, schema, env, debug, inApp, testSuite, hooks, cwd, disableAutoTeardown, }: {
|
|
39
|
+
moduleName?: string;
|
|
40
|
+
env?: Record<string, any>;
|
|
41
|
+
dbName?: string;
|
|
42
|
+
acmekitConfigFile?: string;
|
|
43
|
+
schema?: string;
|
|
44
|
+
debug?: boolean;
|
|
45
|
+
inApp?: boolean;
|
|
46
|
+
testSuite: (options: AcmeKitSuiteOptions) => void;
|
|
47
|
+
hooks?: TestRunnerConfig["hooks"];
|
|
48
|
+
cwd?: string;
|
|
49
|
+
disableAutoTeardown?: boolean;
|
|
50
|
+
}): void;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=acmekit-test-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acmekit-test-runner.d.ts","sourceRoot":"","sources":["../src/acmekit-test-runner.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAqB3D,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,GAAG,CAAA;IACjB,YAAY,EAAE,MAAM,gBAAgB,CAAA;IACpC,GAAG,EAAE,GAAG,CAAA;IACR,OAAO,EAAE;QACP,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;QACzC,QAAQ,EAAE,CAAC,OAAO,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;QACzD,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KAC5C,CAAA;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,CAAA;QACd,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;IACD,aAAa,EAAE,MAAM,gBAAgB,CAAA;IACrC,KAAK,EAAE;QACL,sBAAsB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAC5C,CAAA;CACF;AAED,UAAU,gBAAgB;IACxB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,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