testeranto 0.205.0 → 0.207.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/Dockerfile.mothership +14 -4
- package/Dockerfile.node +5 -3
- package/bundle.js +5 -4
- package/dist/common/src/app/backend/PM_0.js +3 -0
- package/dist/common/src/app/backend/PM_1_WithProcesses.js +2 -0
- package/dist/common/src/app/backend/PM_2_WithTCP.js +2 -0
- package/dist/common/src/app/backend/PM_WithHelpo.js +1 -0
- package/dist/common/src/app/backend/main.js +27 -26
- package/dist/common/src/app/frontend/useFs.js +2 -1
- package/dist/common/src/mothership/mothership.js +197 -0
- package/dist/common/src/testeranto.js +31 -42
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/app/backend/PM_0.js +3 -0
- package/dist/module/src/app/backend/PM_1_WithProcesses.js +2 -0
- package/dist/module/src/app/backend/PM_2_WithTCP.js +2 -0
- package/dist/module/src/app/backend/PM_WithHelpo.js +1 -0
- package/dist/module/src/app/backend/main.js +27 -26
- package/dist/module/src/app/frontend/useFs.js +2 -1
- package/dist/module/src/mothership/mothership.js +196 -0
- package/dist/module/src/testeranto.js +31 -42
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/App.css +68 -12
- package/dist/prebuild/App.js +8 -91
- package/dist/prebuild/mothership.mjs +4 -0
- package/dist/types/src/app/backend/PM_1_WithProcesses.d.ts +0 -1
- package/dist/types/src/app/backend/PM_WithBuild.d.ts +0 -1
- package/dist/types/src/app/backend/main.d.ts +1 -0
- package/dist/types/src/app/frontend/useFs.d.ts +1 -1
- package/dist/types/src/mothership/mothership.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/docker-compose.yml +54 -54
- package/package.json +12 -5
- package/src/app/backend/PM_0.ts +3 -0
- package/src/app/backend/PM_1_WithProcesses.ts +4 -2
- package/src/app/backend/PM_2_WithTCP.ts +3 -0
- package/src/app/backend/PM_WithBuild.ts +0 -2
- package/src/app/backend/PM_WithHelpo.ts +1 -1
- package/src/app/backend/main.ts +26 -8
- package/src/app/frontend/useFs.ts +2 -1
- package/src/mothership/mothership.ts +218 -0
- package/src/testeranto.ts +47 -45
- package/dist/common/src/mothership/index.js +0 -183
- package/dist/module/src/mothership/index.js +0 -178
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +0 -22
- package/dist/prebuild/init-docs.mjs +0 -43
- package/dist/prebuild/testeranto.mjs +0 -5352
- package/dist/types/src/mothership/index.d.ts +0 -2
- package/src/mothership/index.ts +0 -216
package/Dockerfile.mothership
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
FROM node:18-alpine
|
|
1
|
+
FROM node:18-alpine AS dependencies
|
|
2
|
+
|
|
2
3
|
# Install build tools for node-gyp and libxml2-utils for xmllint
|
|
3
4
|
RUN apk add --update make g++ linux-headers python3 libxml2-utils
|
|
4
5
|
WORKDIR /workspace
|
|
5
6
|
COPY package*.json ./
|
|
6
7
|
RUN npm install --legacy-peer-deps
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
FROM node:18-alpine
|
|
10
|
+
WORKDIR /workspace
|
|
11
|
+
# Copy the pre-installed dependencies from the 'dependencies' stage
|
|
12
|
+
# COPY --from=dependencies /app/node_modules ./node_modules
|
|
13
|
+
# Copy the rest of your application source code
|
|
9
14
|
# COPY . .
|
|
15
|
+
# Define the command to run your application
|
|
16
|
+
# CMD ["node", "src/index.js"]
|
|
17
|
+
# Copy the bundled mothership file
|
|
18
|
+
COPY ./dist/prebuild/mothership.mjs mothership.mjsasd
|
|
10
19
|
EXPOSE 8080
|
|
11
|
-
CMD [
|
|
20
|
+
# CMD ['ls']
|
|
21
|
+
CMD ["node", "./dist/prebuild/mothership.mjs"]
|
package/Dockerfile.node
CHANGED
|
@@ -2,8 +2,10 @@ FROM node:18-alpine
|
|
|
2
2
|
# Install build tools for node-gyp and libxml2-utils for xmllint
|
|
3
3
|
RUN apk add --update make g++ linux-headers python3 libxml2-utils
|
|
4
4
|
WORKDIR /workspace
|
|
5
|
+
# Copy package files first to leverage Docker cache
|
|
5
6
|
COPY package*.json ./
|
|
6
7
|
RUN npm install --legacy-peer-deps
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
# Now copy the rest of the source code
|
|
9
|
+
COPY ./src ./src
|
|
10
|
+
Run yarn tsc ./src
|
|
11
|
+
|
package/bundle.js
CHANGED
|
@@ -4,15 +4,16 @@ import { sassPlugin } from 'esbuild-sass-plugin'
|
|
|
4
4
|
await esbuild.build({
|
|
5
5
|
outExtension: { '.js': '.mjs' },
|
|
6
6
|
entryPoints: [
|
|
7
|
-
'src/init-docs.ts',
|
|
8
|
-
'src/esbuildConfigs/eslint-formatter-testeranto.ts',
|
|
9
|
-
'src/testeranto.ts'
|
|
7
|
+
// 'src/init-docs.ts',
|
|
8
|
+
// 'src/esbuildConfigs/eslint-formatter-testeranto.ts',
|
|
9
|
+
// 'src/testeranto.ts',
|
|
10
|
+
'src/mothership/mothership.ts',
|
|
10
11
|
],
|
|
11
12
|
bundle: true,
|
|
12
13
|
format: "esm",
|
|
13
14
|
platform: "node",
|
|
14
15
|
outdir: 'dist/prebuild',
|
|
15
|
-
packages: "external",
|
|
16
|
+
// packages: "external",
|
|
16
17
|
supported: {
|
|
17
18
|
"dynamic-import": true,
|
|
18
19
|
},
|
|
@@ -16,7 +16,10 @@ const recorders = {};
|
|
|
16
16
|
const screenshots = {};
|
|
17
17
|
class PM_0 {
|
|
18
18
|
constructor(configs, projectName, mode) {
|
|
19
|
+
console.log("mark6", configs);
|
|
20
|
+
console.log("mark7", this.configs);
|
|
19
21
|
this.configs = configs;
|
|
22
|
+
console.log("mark8", this.configs);
|
|
20
23
|
this.mode = mode;
|
|
21
24
|
this.projectName = projectName;
|
|
22
25
|
}
|
|
@@ -175,6 +175,8 @@ class PM_1_WithProcesses extends PM_0_js_1.PM_0 {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
};
|
|
178
|
+
console.log("mark5", configs);
|
|
179
|
+
console.log("mark1", this.configs);
|
|
178
180
|
this.configs.tests.forEach(([t, rt, tr, sidecars]) => {
|
|
179
181
|
this.ensureSummaryEntry(t);
|
|
180
182
|
sidecars.forEach(([sidecarName]) => {
|
|
@@ -17,6 +17,8 @@ const PM_1_WithProcesses_js_1 = require("./PM_1_WithProcesses.js");
|
|
|
17
17
|
class PM_2_WithTCP extends PM_1_WithProcesses_js_1.PM_1_WithProcesses {
|
|
18
18
|
constructor(configs, name, mode) {
|
|
19
19
|
super(configs, name, mode);
|
|
20
|
+
console.log("mark2", this.configs);
|
|
21
|
+
console.log("mark3", configs);
|
|
20
22
|
this.httpServer = http_1.default.createServer(this.handleHttpRequest.bind(this));
|
|
21
23
|
this.wss = new ws_1.WebSocketServer({ server: this.httpServer });
|
|
22
24
|
this.wss.on("connection", (ws) => {
|
|
@@ -12,6 +12,7 @@ const node_child_process_1 = require("node:child_process");
|
|
|
12
12
|
// @ts-ignore: node-pty is a CommonJS module
|
|
13
13
|
const fs_1 = __importDefault(require("fs"));
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
|
+
// import { PM_1 } from "./PM_1_WithProcesses.js";
|
|
15
16
|
const PM_WithGit_js_1 = require("./PM_WithGit.js");
|
|
16
17
|
class PM_WithHelpo extends PM_WithGit_js_1.PM_WithGit {
|
|
17
18
|
constructor(configs, name, mode) {
|
|
@@ -57,8 +57,8 @@ const PM_WithHelpo_js_1 = require("./PM_WithHelpo.js");
|
|
|
57
57
|
const files = {};
|
|
58
58
|
const screenshots = {};
|
|
59
59
|
class PM_Main extends PM_WithHelpo_js_1.PM_WithHelpo {
|
|
60
|
-
constructor() {
|
|
61
|
-
super(
|
|
60
|
+
constructor(configs, name, mode) {
|
|
61
|
+
super(configs, name, mode);
|
|
62
62
|
this.launchPure = async (src, dest) => {
|
|
63
63
|
console.log(ansi_colors_2.default.green(ansi_colors_2.default.inverse(`pure < ${src}`)));
|
|
64
64
|
const processId = `pure-${src}-${Date.now()}`;
|
|
@@ -262,6 +262,7 @@ class PM_Main extends PM_WithHelpo_js_1.PM_WithHelpo {
|
|
|
262
262
|
const command = `web test: ${src}`;
|
|
263
263
|
// Create the promise
|
|
264
264
|
const webPromise = (async () => {
|
|
265
|
+
var _a, _b;
|
|
265
266
|
this.bddTestIsRunning(src);
|
|
266
267
|
const reportDest = `testeranto/reports/${this.projectName}/${src
|
|
267
268
|
.split(".")
|
|
@@ -279,12 +280,16 @@ class PM_Main extends PM_WithHelpo_js_1.PM_WithHelpo {
|
|
|
279
280
|
});
|
|
280
281
|
const d = `${dest}?cacheBust=${Date.now()}`;
|
|
281
282
|
const logs = (0, utils_js_2.createLogStreams)(reportDest, "web");
|
|
283
|
+
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write("testing123");
|
|
284
|
+
(_b = logs.info) === null || _b === void 0 ? void 0 : _b.write("wtf");
|
|
282
285
|
return new Promise((resolve, reject) => {
|
|
283
286
|
this.browser
|
|
284
287
|
.newPage()
|
|
285
288
|
.then((page) => {
|
|
289
|
+
// page.on("")
|
|
286
290
|
page.on("console", (log) => {
|
|
287
291
|
var _a, _b, _c, _d;
|
|
292
|
+
console.log("mark9", log);
|
|
288
293
|
const msg = `${log.text()}\n`;
|
|
289
294
|
switch (log.type()) {
|
|
290
295
|
case "info":
|
|
@@ -304,6 +309,8 @@ class PM_Main extends PM_WithHelpo_js_1.PM_WithHelpo {
|
|
|
304
309
|
}
|
|
305
310
|
});
|
|
306
311
|
page.on("close", () => {
|
|
312
|
+
var _a;
|
|
313
|
+
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write("close 1");
|
|
307
314
|
logs.writeExitCode(0);
|
|
308
315
|
logs.closeAll();
|
|
309
316
|
});
|
|
@@ -326,6 +333,8 @@ class PM_Main extends PM_WithHelpo_js_1.PM_WithHelpo {
|
|
|
326
333
|
})
|
|
327
334
|
.then(async (page) => {
|
|
328
335
|
const close = () => {
|
|
336
|
+
var _a;
|
|
337
|
+
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write("close2");
|
|
329
338
|
if (!files[src]) {
|
|
330
339
|
files[src] = new Set();
|
|
331
340
|
}
|
|
@@ -336,21 +345,31 @@ class PM_Main extends PM_WithHelpo_js_1.PM_WithHelpo {
|
|
|
336
345
|
});
|
|
337
346
|
};
|
|
338
347
|
page.on("pageerror", (err) => {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
348
|
+
var _a;
|
|
349
|
+
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write("pageerror");
|
|
350
|
+
// logs.writeExitCode(-1, err);
|
|
351
|
+
// console.log(
|
|
352
|
+
// ansiColors.red(
|
|
353
|
+
// `web ! ${src} failed to execute No "tests.json" file was generated. Check ${reportDest}/error.log for more info`
|
|
354
|
+
// )
|
|
355
|
+
// );
|
|
356
|
+
// this.bddTestIsNowDone(src, -1);
|
|
357
|
+
// close();
|
|
343
358
|
reject(err);
|
|
344
359
|
});
|
|
345
360
|
await page.goto(`file://${`${destFolder}.html`}`, {});
|
|
346
361
|
await page
|
|
347
362
|
.evaluate((0, utils_js_1.webEvaluator)(d, webArgz))
|
|
348
363
|
.then(async ({ fails, failed, features }) => {
|
|
364
|
+
var _a;
|
|
365
|
+
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write("\n idk1");
|
|
349
366
|
(0, utils_js_2.statusMessagePretty)(fails, src, "web");
|
|
350
367
|
this.bddTestIsNowDone(src, fails);
|
|
351
368
|
resolve();
|
|
352
369
|
})
|
|
353
370
|
.catch((e) => {
|
|
371
|
+
var _a;
|
|
372
|
+
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write("\n idk2");
|
|
354
373
|
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(e.stack)));
|
|
355
374
|
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`web ! ${src} failed to execute. No "tests.json" file was generated. Check logs for more info`)));
|
|
356
375
|
// Create a minimal tests.json even on failure
|
|
@@ -367,6 +386,8 @@ class PM_Main extends PM_WithHelpo_js_1.PM_WithHelpo {
|
|
|
367
386
|
reject(e);
|
|
368
387
|
})
|
|
369
388
|
.finally(async () => {
|
|
389
|
+
var _a;
|
|
390
|
+
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write("\n idk3");
|
|
370
391
|
// Generate prompt files for Web tests
|
|
371
392
|
await this.generatePromptFiles(reportDest, src);
|
|
372
393
|
close();
|
|
@@ -555,26 +576,6 @@ class PM_Main extends PM_WithHelpo_js_1.PM_WithHelpo {
|
|
|
555
576
|
})();
|
|
556
577
|
this.addPromiseProcess(processId, golangPromise, command, "bdd-test", src, "golang");
|
|
557
578
|
};
|
|
558
|
-
// private getGolangSourceFiles(src: string): string[] {
|
|
559
|
-
// // Get all .go files in the same directory as the test
|
|
560
|
-
// const testDir = path.dirname(src);
|
|
561
|
-
// const files: string[] = [];
|
|
562
|
-
// try {
|
|
563
|
-
// const dirContents = fs.readdirSync(testDir);
|
|
564
|
-
// dirContents.forEach((file) => {
|
|
565
|
-
// if (file.endsWith(".go")) {
|
|
566
|
-
// files.push(path.join(testDir, file));
|
|
567
|
-
// }
|
|
568
|
-
// });
|
|
569
|
-
// } catch (error) {
|
|
570
|
-
// console.error(`Error reading directory ${testDir}:`, error);
|
|
571
|
-
// }
|
|
572
|
-
// // Always include the main test file
|
|
573
|
-
// if (!files.includes(src)) {
|
|
574
|
-
// files.push(src);
|
|
575
|
-
// }
|
|
576
|
-
// return files;
|
|
577
|
-
// }
|
|
578
579
|
}
|
|
579
580
|
async startBuildProcesses() {
|
|
580
581
|
const { nodeEntryPoints, webEntryPoints, pureEntryPoints } = (0, utils_js_1.getRunnables)(this.configs.tests, this.projectName);
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// import Docker from "dockerode";
|
|
4
|
+
console.log("hello mothership");
|
|
5
|
+
// const app = express();
|
|
6
|
+
// app.use(express.json());
|
|
7
|
+
// // const docker = new Docker();
|
|
8
|
+
// // Track running services
|
|
9
|
+
// const runningServices = new Map();
|
|
10
|
+
// // Service to build file mapping
|
|
11
|
+
// const serviceBuildFiles = {
|
|
12
|
+
// "node-build": "src/builders/node.ts",
|
|
13
|
+
// "web-build": "src/builders/web.ts",
|
|
14
|
+
// "golang-build": "src/builders/golang.ts",
|
|
15
|
+
// "python-build": "src/builders/python.ts",
|
|
16
|
+
// };
|
|
17
|
+
// // Automatically start build services on mothership startup
|
|
18
|
+
// async function initializeServices() {
|
|
19
|
+
// console.log("Initializing build services...");
|
|
20
|
+
// for (const serviceName of Object.keys(serviceBuildFiles)) {
|
|
21
|
+
// try {
|
|
22
|
+
// // Get all containers
|
|
23
|
+
// // const containers = await docker.listContainers({ all: true });
|
|
24
|
+
// // Find the container for the requested service
|
|
25
|
+
// // const containerInfo = containers.find((container) =>
|
|
26
|
+
// // container.Names.some((name) => name.includes(serviceName))
|
|
27
|
+
// // );
|
|
28
|
+
// // if (containerInfo) {
|
|
29
|
+
// // // const container = docker.getContainer(containerInfo.Id);
|
|
30
|
+
// // // Start the container if it's not running
|
|
31
|
+
// // if (containerInfo.State !== "running") {
|
|
32
|
+
// // console.log(`Starting ${serviceName}...`);
|
|
33
|
+
// // await container.start();
|
|
34
|
+
// // } else {
|
|
35
|
+
// // console.log(`${serviceName} is already running`);
|
|
36
|
+
// // }
|
|
37
|
+
// // runningServices.set(serviceName, containerInfo.Id);
|
|
38
|
+
// // } else {
|
|
39
|
+
// // console.warn(`Container for ${serviceName} not found`);
|
|
40
|
+
// // }
|
|
41
|
+
// } catch (error) {
|
|
42
|
+
// console.error(`Error initializing ${serviceName}:`, error);
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
// console.log("Build services initialization complete");
|
|
46
|
+
// }
|
|
47
|
+
// // Initialize services when mothership starts
|
|
48
|
+
// initializeServices();
|
|
49
|
+
// app.get("/", (req, res) => {
|
|
50
|
+
// res.send("Mothership is running");
|
|
51
|
+
// });
|
|
52
|
+
// // Start a specific service
|
|
53
|
+
// app.post("/services/:serviceName/start", async (req, res) => {
|
|
54
|
+
// const { serviceName } = req.params;
|
|
55
|
+
// try {
|
|
56
|
+
// // // Get all containers
|
|
57
|
+
// // const containers = await docker.listContainers({ all: true });
|
|
58
|
+
// // // Find the container for the requested service
|
|
59
|
+
// // const containerInfo = containers.find((container) =>
|
|
60
|
+
// // container.Names.some((name) => name.includes(serviceName))
|
|
61
|
+
// // );
|
|
62
|
+
// // if (!containerInfo) {
|
|
63
|
+
// // return res
|
|
64
|
+
// // .status(404)
|
|
65
|
+
// // .json({ error: `Service ${serviceName} not found` });
|
|
66
|
+
// // }
|
|
67
|
+
// // const container = docker.getContainer(containerInfo.Id);
|
|
68
|
+
// // // Start the container if it's not running
|
|
69
|
+
// // if (containerInfo.State !== "running") {
|
|
70
|
+
// // await container.start();
|
|
71
|
+
// // }
|
|
72
|
+
// // runningServices.set(serviceName, containerInfo.Id);
|
|
73
|
+
// // res.status(200).json({
|
|
74
|
+
// // status: "started",
|
|
75
|
+
// // service: serviceName,
|
|
76
|
+
// // containerId: containerInfo.Id,
|
|
77
|
+
// // });
|
|
78
|
+
// } catch (error) {
|
|
79
|
+
// console.error(`Error starting service ${serviceName}:`, error);
|
|
80
|
+
// res
|
|
81
|
+
// .status(500)
|
|
82
|
+
// .json({ error: `Failed to start service: ${error.message}` });
|
|
83
|
+
// }
|
|
84
|
+
// });
|
|
85
|
+
// // Stop a specific service
|
|
86
|
+
// app.post("/services/:serviceName/stop", async (req, res) => {
|
|
87
|
+
// const { serviceName } = req.params;
|
|
88
|
+
// try {
|
|
89
|
+
// // const containerId = runningServices.get(serviceName);
|
|
90
|
+
// // if (!containerId) {
|
|
91
|
+
// // return res
|
|
92
|
+
// // .status(404)
|
|
93
|
+
// // .json({ error: `Service ${serviceName} is not running` });
|
|
94
|
+
// // }
|
|
95
|
+
// // const container = docker.getContainer(containerId);
|
|
96
|
+
// // await container.stop();
|
|
97
|
+
// // runningServices.delete(serviceName);
|
|
98
|
+
// res.status(200).json({
|
|
99
|
+
// status: "stopped",
|
|
100
|
+
// service: serviceName,
|
|
101
|
+
// });
|
|
102
|
+
// } catch (error) {
|
|
103
|
+
// console.error(`Error stopping service ${serviceName}:`, error);
|
|
104
|
+
// res.status(500).json({ error: `Failed to stop service: ${error.message}` });
|
|
105
|
+
// }
|
|
106
|
+
// });
|
|
107
|
+
// // Get status of all services
|
|
108
|
+
// app.get("/services", async (req, res) => {
|
|
109
|
+
// try {
|
|
110
|
+
// // const containers = await docker.listContainers({ all: true });
|
|
111
|
+
// // const services = containers
|
|
112
|
+
// // .filter((container) =>
|
|
113
|
+
// // container.Names.some((name) =>
|
|
114
|
+
// // name.match(
|
|
115
|
+
// // /_(node-build|web-build|golang-build|python-build|mothership)_/
|
|
116
|
+
// // )
|
|
117
|
+
// // )
|
|
118
|
+
// // )
|
|
119
|
+
// // .map((container) => ({
|
|
120
|
+
// // name: container.Names[0].replace("/", ""),
|
|
121
|
+
// // id: container.Id,
|
|
122
|
+
// // status: container.State,
|
|
123
|
+
// // image: container.Image,
|
|
124
|
+
// // }));
|
|
125
|
+
// // res.status(200).json({ services });
|
|
126
|
+
// } catch (error) {
|
|
127
|
+
// console.error("Error listing services:", error);
|
|
128
|
+
// res
|
|
129
|
+
// .status(500)
|
|
130
|
+
// .json({ error: `Failed to list services: ${error.message}` });
|
|
131
|
+
// }
|
|
132
|
+
// });
|
|
133
|
+
// // Trigger a build in a specific service
|
|
134
|
+
// app.post("/build/:serviceName", async (req, res) => {
|
|
135
|
+
// // const { serviceName } = req.params;
|
|
136
|
+
// // try {
|
|
137
|
+
// // const containerId = runningServices.get(serviceName);
|
|
138
|
+
// // if (!containerId) {
|
|
139
|
+
// // return res
|
|
140
|
+
// // .status(404)
|
|
141
|
+
// // .json({ error: `Service ${serviceName} is not running` });
|
|
142
|
+
// // }
|
|
143
|
+
// // // const container = docker.getContainer(containerId);
|
|
144
|
+
// // // Execute the build command in the container
|
|
145
|
+
// // const buildFile = serviceBuildFiles[serviceName];
|
|
146
|
+
// // if (!buildFile) {
|
|
147
|
+
// // return res
|
|
148
|
+
// // .status(400)
|
|
149
|
+
// // .json({ error: `No build file configured for ${serviceName}` });
|
|
150
|
+
// // }
|
|
151
|
+
// // // Run the TypeScript build file using ts-node
|
|
152
|
+
// // const exec = await container.exec({
|
|
153
|
+
// // Cmd: ["npx", "ts-node", "--transpile-only", buildFile],
|
|
154
|
+
// // AttachStdout: true,
|
|
155
|
+
// // AttachStderr: true,
|
|
156
|
+
// // });
|
|
157
|
+
// // // Start the exec instance
|
|
158
|
+
// // const stream = await exec.start({ hijack: true, stdin: false });
|
|
159
|
+
// // // Collect output
|
|
160
|
+
// // let output = "";
|
|
161
|
+
// // stream.on("data", (chunk: Buffer) => {
|
|
162
|
+
// // output += chunk.toString();
|
|
163
|
+
// // });
|
|
164
|
+
// // stream.on("end", () => {
|
|
165
|
+
// // res.status(200).json({
|
|
166
|
+
// // status: "build completed",
|
|
167
|
+
// // service: serviceName,
|
|
168
|
+
// // output: output,
|
|
169
|
+
// // });
|
|
170
|
+
// // });
|
|
171
|
+
// // stream.on("error", (error) => {
|
|
172
|
+
// // console.error(`Stream error for ${serviceName}:`, error);
|
|
173
|
+
// // res.status(500).json({ error: `Build stream error: ${error.message}` });
|
|
174
|
+
// // });
|
|
175
|
+
// // } catch (error) {
|
|
176
|
+
// // console.error(`Error triggering build for ${serviceName}:`, error);
|
|
177
|
+
// // res
|
|
178
|
+
// // .status(500)
|
|
179
|
+
// // .json({ error: `Failed to trigger build: ${error.message}` });
|
|
180
|
+
// // }
|
|
181
|
+
// });
|
|
182
|
+
// // Get build file for each service
|
|
183
|
+
// app.get("/build-files", (req, res) => {
|
|
184
|
+
// res.status(200).json(serviceBuildFiles);
|
|
185
|
+
// });
|
|
186
|
+
// // Claim resource endpoint
|
|
187
|
+
// app.get("/claim", (req, res) => {
|
|
188
|
+
// const { resource } = req.query;
|
|
189
|
+
// console.log(`Resource claimed: ${resource}`);
|
|
190
|
+
// res.status(200).json({ status: "claimed", resource });
|
|
191
|
+
// });
|
|
192
|
+
// export default (port: number) => {
|
|
193
|
+
// app.listen(port, () => {
|
|
194
|
+
// console.log(`Mothership listening on port ${port}`);
|
|
195
|
+
// });
|
|
196
|
+
// return app;
|
|
197
|
+
// };
|
|
@@ -44,7 +44,9 @@ const readline_1 = __importDefault(require("readline"));
|
|
|
44
44
|
const buildTemplates_1 = require("./utils/buildTemplates");
|
|
45
45
|
const pitonoBuild_1 = require("./PM/pitonoBuild");
|
|
46
46
|
const utils_1 = require("./app/backend/utils");
|
|
47
|
+
const path_1 = __importDefault(require("path"));
|
|
47
48
|
const { GolingvuBuild } = await Promise.resolve().then(() => __importStar(require("./PM/golingvuBuild")));
|
|
49
|
+
const web_html_1 = __importDefault(require("./web.html"));
|
|
48
50
|
// if (!process.env.GITHUB_CLIENT_ID) {
|
|
49
51
|
// console.error(`env var "GITHUB_CLIENT_ID" needs to be set!`);
|
|
50
52
|
// process.exit(-1);
|
|
@@ -113,53 +115,40 @@ Promise.resolve(`${configFilePath}`).then(s => __importStar(require(s))).then(as
|
|
|
113
115
|
}
|
|
114
116
|
fs_1.default.writeFileSync(`testeranto/reports/${projectName}/config.json`, JSON.stringify(config, null, 2));
|
|
115
117
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
118
|
+
const getSecondaryEndpointsPoints = (runtime) => {
|
|
119
|
+
const meta = (ts, st) => {
|
|
120
|
+
ts.forEach((t) => {
|
|
121
|
+
if (t[1] === runtime) {
|
|
122
|
+
st.add(t[0]);
|
|
123
|
+
}
|
|
124
|
+
if (Array.isArray(t[3])) {
|
|
125
|
+
meta(t[3], st);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return st;
|
|
129
|
+
};
|
|
130
|
+
return Array.from(meta(config.tests, new Set()));
|
|
131
|
+
};
|
|
130
132
|
// Also handle pitono endpoints for HTML generation if needed
|
|
131
133
|
// [...getSecondaryEndpointsPoints("python")].forEach(async (sourceFilePath) => {
|
|
132
134
|
// // You might want to generate specific files for pitono tests here
|
|
133
135
|
// console.log(`Pitono test found: ${sourceFilePath}`);
|
|
134
136
|
// });
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
|
|
151
|
-
// const cssFilePath = `./${sourceFileNameMinusJs}.css`;
|
|
152
|
-
// return fs.promises
|
|
153
|
-
// .mkdir(path.dirname(htmlFilePath), { recursive: true })
|
|
154
|
-
// .then((x) =>
|
|
155
|
-
// fs.writeFileSync(
|
|
156
|
-
// htmlFilePath,
|
|
157
|
-
// webHtmlFrame(jsfilePath, htmlFilePath, cssFilePath)
|
|
158
|
-
// )
|
|
159
|
-
// );
|
|
160
|
-
// })
|
|
161
|
-
// )
|
|
162
|
-
// );
|
|
137
|
+
Promise.resolve(Promise.all([...getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
|
|
138
|
+
const sourceFileSplit = sourceFilePath.split("/");
|
|
139
|
+
const sourceDir = sourceFileSplit.slice(0, -1);
|
|
140
|
+
const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
|
|
141
|
+
const sourceFileNameMinusJs = sourceFileName
|
|
142
|
+
.split(".")
|
|
143
|
+
.slice(0, -1)
|
|
144
|
+
.join(".");
|
|
145
|
+
const htmlFilePath = path_1.default.normalize(`${process.cwd()}/testeranto/bundles/web/${testName}/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
|
|
146
|
+
const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
|
|
147
|
+
const cssFilePath = `./${sourceFileNameMinusJs}.css`;
|
|
148
|
+
return fs_1.default.promises
|
|
149
|
+
.mkdir(path_1.default.dirname(htmlFilePath), { recursive: true })
|
|
150
|
+
.then((x) => fs_1.default.writeFileSync(htmlFilePath, (0, web_html_1.default)(jsfilePath, htmlFilePath, cssFilePath)));
|
|
151
|
+
})));
|
|
163
152
|
const { nodeEntryPoints, nodeEntryPointSidecars, webEntryPoints, webEntryPointSidecars, pureEntryPoints, pureEntryPointSidecars, pythonEntryPoints, pythonEntryPointSidecars, golangEntryPoints, golangEntryPointSidecars, } = (0, utils_1.getRunnables)(config.tests, testName);
|
|
164
153
|
// Debug logging to check if entry points are being found
|
|
165
154
|
console.log("Node entry points:", Object.keys(nodeEntryPoints));
|