testeranto 0.219.14 → 0.219.15
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/package.json +1 -1
- package/src/testeranto.ts +1 -1
- package/dist/common/allTestsUtils.js +0 -17
- package/dist/common/package.json +0 -3
- package/dist/common/scripts/build-example.js +0 -105
- package/dist/common/src/Init.js +0 -38
- package/dist/common/src/Types.js +0 -63
- package/dist/common/src/esbuildConfigs/consoleDetectorPlugin.js +0 -38
- package/dist/common/src/esbuildConfigs/eslint-formatter-testeranto.js +0 -21
- package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
- package/dist/common/src/esbuildConfigs/index.js +0 -22
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -30
- package/dist/common/src/esbuildConfigs/nativeImportDetectorPlugin.js +0 -24
- package/dist/common/src/esbuildConfigs/rebuildPlugin.js +0 -19
- package/dist/common/src/init-docs.js +0 -9
- package/dist/common/src/lib/tiposkripto/BaseGiven.js +0 -96
- package/dist/common/src/lib/tiposkripto/BaseSuite.js +0 -134
- package/dist/common/src/lib/tiposkripto/BaseThen.js +0 -65
- package/dist/common/src/lib/tiposkripto/BaseTiposkripto.js +0 -193
- package/dist/common/src/lib/tiposkripto/BaseWhen.js +0 -46
- package/dist/common/src/lib/tiposkripto/CoreTypes.js +0 -2
- package/dist/common/src/lib/tiposkripto/Node.js +0 -40
- package/dist/common/src/lib/tiposkripto/Tiposkripto.js +0 -49
- package/dist/common/src/lib/tiposkripto/Types.js +0 -2
- package/dist/common/src/lib/tiposkripto/Web.js +0 -70
- package/dist/common/src/lib/tiposkripto/abstractBase.test/MockGiven.js +0 -22
- package/dist/common/src/lib/tiposkripto/abstractBase.test/MockThen.js +0 -16
- package/dist/common/src/lib/tiposkripto/abstractBase.test/MockWhen.js +0 -18
- package/dist/common/src/lib/tiposkripto/abstractBase.test/adapter.js +0 -24
- package/dist/common/src/lib/tiposkripto/abstractBase.test/implementation.js +0 -38
- package/dist/common/src/lib/tiposkripto/abstractBase.test/index.js +0 -17
- package/dist/common/src/lib/tiposkripto/abstractBase.test/specification.js +0 -19
- package/dist/common/src/lib/tiposkripto/abstractBase.test/types.js +0 -2
- package/dist/common/src/lib/tiposkripto/index.js +0 -29
- package/dist/common/src/runtimes.js +0 -4
- package/dist/common/src/server/aider/configParser.js +0 -124
- package/dist/common/src/server/aider/docker.js +0 -30
- package/dist/common/src/server/getRunnables.js +0 -36
- package/dist/common/src/server/htmlTemplate.js +0 -44
- package/dist/common/src/server/nodeVersion.js +0 -5
- package/dist/common/src/server/runtimes/common.js +0 -136
- package/dist/common/src/server/runtimes/golang/docker.js +0 -62
- package/dist/common/src/server/runtimes/java/docker.js +0 -46
- package/dist/common/src/server/runtimes/node/docker.js +0 -42
- package/dist/common/src/server/runtimes/node/esbuild.js +0 -40
- package/dist/common/src/server/runtimes/node/node.js +0 -75
- package/dist/common/src/server/runtimes/python/docker.js +0 -31
- package/dist/common/src/server/runtimes/ruby/docker.js +0 -34
- package/dist/common/src/server/runtimes/rust/docker.js +0 -35
- package/dist/common/src/server/runtimes/web/docker.js +0 -42
- package/dist/common/src/server/runtimes/web/esbuild.js +0 -29
- package/dist/common/src/server/runtimes/web/hoist.js +0 -16
- package/dist/common/src/server/runtimes/web/web.js +0 -157
- package/dist/common/src/server/serverClasees/Server.js +0 -47
- package/dist/common/src/server/serverClasees/Server_Base.js +0 -18
- package/dist/common/src/server/serverClasees/Server_Docker.js +0 -904
- package/dist/common/src/server/serverClasees/Server_FS.js +0 -119
- package/dist/common/src/server/serverClasees/Server_HTTP.js +0 -189
- package/dist/common/src/server/serverClasees/Server_WS.js +0 -262
- package/dist/common/src/server/serverManagers/DockerManager.js +0 -28
- package/dist/common/src/server/serverManagers/HttpManager.js +0 -114
- package/dist/common/src/server/serverManagers/WsManager.js +0 -230
- package/dist/common/src/server/serverManagers/fs.js +0 -32
- package/dist/common/src/server/serverManagers/tcp.js +0 -51
- package/dist/common/src/server/types.js +0 -2
- package/dist/common/src/testeranto.js +0 -75
- package/dist/common/src/vscode/TerminalManager.js +0 -129
- package/dist/common/src/vscode/TestTreeItem.js +0 -77
- package/dist/common/src/vscode/extension.js +0 -185
- package/dist/common/src/vscode/providers/FeaturesTreeDataProvider.js +0 -445
- package/dist/common/src/vscode/providers/FileTreeDataProvider.js +0 -190
- package/dist/common/src/vscode/providers/ProcessesTreeDataProvider.js +0 -270
- package/dist/common/src/vscode/providers/ResultsTreeDataProvider.js +0 -87
- package/dist/common/src/vscode/providers/TestTreeDataProvider.js +0 -309
- package/dist/common/src/vscode/types.js +0 -9
- package/dist/common/testeranto/runtimes/node/node.js +0 -7
- package/dist/common/testeranto/runtimes/web/web.js +0 -6
- package/dist/common/testeranto/testeranto.js +0 -70
- package/dist/common/tsconfig.common.tsbuildinfo +0 -1
- package/dist/module/allTestsUtils.js +0 -13
- package/dist/module/package.json +0 -3
- package/dist/module/scripts/build-example.js +0 -100
- package/dist/module/src/Init.js +0 -33
- package/dist/module/src/Types.js +0 -62
- package/dist/module/src/esbuildConfigs/consoleDetectorPlugin.js +0 -32
- package/dist/module/src/esbuildConfigs/eslint-formatter-testeranto.js +0 -18
- package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
- package/dist/module/src/esbuildConfigs/index.js +0 -20
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -25
- package/dist/module/src/esbuildConfigs/nativeImportDetectorPlugin.js +0 -21
- package/dist/module/src/esbuildConfigs/rebuildPlugin.js +0 -14
- package/dist/module/src/init-docs.js +0 -4
- package/dist/module/src/lib/tiposkripto/BaseGiven.js +0 -92
- package/dist/module/src/lib/tiposkripto/BaseSuite.js +0 -130
- package/dist/module/src/lib/tiposkripto/BaseThen.js +0 -61
- package/dist/module/src/lib/tiposkripto/BaseTiposkripto.js +0 -190
- package/dist/module/src/lib/tiposkripto/BaseWhen.js +0 -42
- package/dist/module/src/lib/tiposkripto/CoreTypes.js +0 -1
- package/dist/module/src/lib/tiposkripto/Node.js +0 -33
- package/dist/module/src/lib/tiposkripto/Tiposkripto.js +0 -14
- package/dist/module/src/lib/tiposkripto/Types.js +0 -1
- package/dist/module/src/lib/tiposkripto/Web.js +0 -63
- package/dist/module/src/lib/tiposkripto/abstractBase.test/MockGiven.js +0 -18
- package/dist/module/src/lib/tiposkripto/abstractBase.test/MockThen.js +0 -12
- package/dist/module/src/lib/tiposkripto/abstractBase.test/MockWhen.js +0 -14
- package/dist/module/src/lib/tiposkripto/abstractBase.test/adapter.js +0 -21
- package/dist/module/src/lib/tiposkripto/abstractBase.test/implementation.js +0 -35
- package/dist/module/src/lib/tiposkripto/abstractBase.test/index.js +0 -12
- package/dist/module/src/lib/tiposkripto/abstractBase.test/specification.js +0 -15
- package/dist/module/src/lib/tiposkripto/abstractBase.test/types.js +0 -1
- package/dist/module/src/lib/tiposkripto/index.js +0 -24
- package/dist/module/src/runtimes.js +0 -1
- package/dist/module/src/server/aider/configParser.js +0 -116
- package/dist/module/src/server/aider/docker.js +0 -28
- package/dist/module/src/server/getRunnables.js +0 -29
- package/dist/module/src/server/htmlTemplate.js +0 -40
- package/dist/module/src/server/nodeVersion.js +0 -2
- package/dist/module/src/server/runtimes/common.js +0 -127
- package/dist/module/src/server/runtimes/golang/docker.js +0 -55
- package/dist/module/src/server/runtimes/java/docker.js +0 -40
- package/dist/module/src/server/runtimes/node/docker.js +0 -36
- package/dist/module/src/server/runtimes/node/esbuild.js +0 -35
- package/dist/module/src/server/runtimes/node/node.js +0 -37
- package/dist/module/src/server/runtimes/python/docker.js +0 -25
- package/dist/module/src/server/runtimes/ruby/docker.js +0 -28
- package/dist/module/src/server/runtimes/rust/docker.js +0 -29
- package/dist/module/src/server/runtimes/web/docker.js +0 -36
- package/dist/module/src/server/runtimes/web/esbuild.js +0 -24
- package/dist/module/src/server/runtimes/web/hoist.js +0 -11
- package/dist/module/src/server/runtimes/web/web.js +0 -119
- package/dist/module/src/server/serverClasees/Server.js +0 -40
- package/dist/module/src/server/serverClasees/Server_Base.js +0 -14
- package/dist/module/src/server/serverClasees/Server_Docker.js +0 -897
- package/dist/module/src/server/serverClasees/Server_FS.js +0 -119
- package/dist/module/src/server/serverClasees/Server_HTTP.js +0 -182
- package/dist/module/src/server/serverClasees/Server_WS.js +0 -258
- package/dist/module/src/server/serverManagers/DockerManager.js +0 -28
- package/dist/module/src/server/serverManagers/HttpManager.js +0 -110
- package/dist/module/src/server/serverManagers/WsManager.js +0 -226
- package/dist/module/src/server/serverManagers/fs.js +0 -32
- package/dist/module/src/server/serverManagers/tcp.js +0 -47
- package/dist/module/src/server/types.js +0 -1
- package/dist/module/src/testeranto.js +0 -40
- package/dist/module/src/vscode/TerminalManager.js +0 -92
- package/dist/module/src/vscode/TestTreeItem.js +0 -40
- package/dist/module/src/vscode/extension.js +0 -148
- package/dist/module/src/vscode/providers/FeaturesTreeDataProvider.js +0 -408
- package/dist/module/src/vscode/providers/FileTreeDataProvider.js +0 -153
- package/dist/module/src/vscode/providers/ProcessesTreeDataProvider.js +0 -233
- package/dist/module/src/vscode/providers/ResultsTreeDataProvider.js +0 -50
- package/dist/module/src/vscode/providers/TestTreeDataProvider.js +0 -272
- package/dist/module/src/vscode/types.js +0 -6
- package/dist/module/testeranto/runtimes/node/node.js +0 -5
- package/dist/module/testeranto/runtimes/web/web.js +0 -4
- package/dist/module/testeranto/testeranto.js +0 -68
- package/dist/module/tsconfig.module.tsbuildinfo +0 -1
- package/dist/prebuild/chunk-QLT7PNPK.mjs +0 -162
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +0 -20
- package/dist/prebuild/init-docs.mjs +0 -56
- package/dist/prebuild/server/runtimes/node/node.mjs +0 -80
- package/dist/prebuild/server/runtimes/web/hoist.mjs +0 -12
- package/dist/prebuild/server/runtimes/web/web.mjs +0 -162
- package/dist/prebuild/testeranto-6SAYRVSE.mjs +0 -72
- package/dist/prebuild/testeranto.mjs +0 -1692
- package/dist/types/src/Init.d.ts +0 -2
- package/dist/types/src/Types.d.ts +0 -87
- package/dist/types/src/esbuildConfigs/consoleDetectorPlugin.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/eslint-formatter-testeranto.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
- package/dist/types/src/esbuildConfigs/index.d.ts +0 -3
- package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
- package/dist/types/src/esbuildConfigs/nativeImportDetectorPlugin.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/rebuildPlugin.d.ts +0 -6
- package/dist/types/src/init-docs.d.ts +0 -1
- package/dist/types/src/lib/tiposkripto/BaseGiven.d.ts +0 -42
- package/dist/types/src/lib/tiposkripto/BaseSuite.d.ts +0 -46
- package/dist/types/src/lib/tiposkripto/BaseThen.d.ts +0 -28
- package/dist/types/src/lib/tiposkripto/BaseTiposkripto.d.ts +0 -35
- package/dist/types/src/lib/tiposkripto/BaseWhen.d.ts +0 -27
- package/dist/types/src/lib/tiposkripto/CoreTypes.d.ts +0 -51
- package/dist/types/src/lib/tiposkripto/Node.d.ts +0 -9
- package/dist/types/src/lib/tiposkripto/Tiposkripto.d.ts +0 -5
- package/dist/types/src/lib/tiposkripto/Types.d.ts +0 -9
- package/dist/types/src/lib/tiposkripto/Web.d.ts +0 -9
- package/dist/types/src/lib/tiposkripto/abstractBase.test/MockGiven.d.ts +0 -9
- package/dist/types/src/lib/tiposkripto/abstractBase.test/MockThen.d.ts +0 -6
- package/dist/types/src/lib/tiposkripto/abstractBase.test/MockWhen.d.ts +0 -6
- package/dist/types/src/lib/tiposkripto/abstractBase.test/adapter.d.ts +0 -3
- package/dist/types/src/lib/tiposkripto/abstractBase.test/implementation.d.ts +0 -3
- package/dist/types/src/lib/tiposkripto/abstractBase.test/index.d.ts +0 -28
- package/dist/types/src/lib/tiposkripto/abstractBase.test/specification.d.ts +0 -3
- package/dist/types/src/lib/tiposkripto/abstractBase.test/types.d.ts +0 -39
- package/dist/types/src/lib/tiposkripto/index.d.ts +0 -56
- package/dist/types/src/runtimes.d.ts +0 -2
- package/dist/types/src/server/aider/configParser.d.ts +0 -11
- package/dist/types/src/server/aider/docker.d.ts +0 -2
- package/dist/types/src/server/getRunnables.d.ts +0 -3
- package/dist/types/src/server/htmlTemplate.d.ts +0 -2
- package/dist/types/src/server/nodeVersion.d.ts +0 -2
- package/dist/types/src/server/runtimes/common.d.ts +0 -12
- package/dist/types/src/server/runtimes/golang/docker.d.ts +0 -5
- package/dist/types/src/server/runtimes/java/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/node/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/node/esbuild.d.ts +0 -4
- package/dist/types/src/server/runtimes/node/node.d.ts +0 -1
- package/dist/types/src/server/runtimes/python/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/ruby/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/rust/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/web/docker.d.ts +0 -15
- package/dist/types/src/server/runtimes/web/esbuild.d.ts +0 -4
- package/dist/types/src/server/runtimes/web/hoist.d.ts +0 -1
- package/dist/types/src/server/runtimes/web/web.d.ts +0 -1
- package/dist/types/src/server/serverClasees/Server.d.ts +0 -8
- package/dist/types/src/server/serverClasees/Server_Base.d.ts +0 -9
- package/dist/types/src/server/serverClasees/Server_Docker.d.ts +0 -81
- package/dist/types/src/server/serverClasees/Server_FS.d.ts +0 -0
- package/dist/types/src/server/serverClasees/Server_HTTP.d.ts +0 -20
- package/dist/types/src/server/serverClasees/Server_WS.d.ts +0 -23
- package/dist/types/src/server/serverManagers/DockerManager.d.ts +0 -0
- package/dist/types/src/server/serverManagers/HttpManager.d.ts +0 -9
- package/dist/types/src/server/serverManagers/WsManager.d.ts +0 -10
- package/dist/types/src/server/serverManagers/fs.d.ts +0 -0
- package/dist/types/src/server/serverManagers/tcp.d.ts +0 -27
- package/dist/types/src/server/types.d.ts +0 -68
- package/dist/types/src/testeranto.d.ts +0 -1
- package/dist/types/src/vscode/TerminalManager.d.ts +0 -18
- package/dist/types/src/vscode/TestTreeItem.d.ts +0 -13
- package/dist/types/src/vscode/extension.d.ts +0 -3
- package/dist/types/src/vscode/providers/FeaturesTreeDataProvider.d.ts +0 -17
- package/dist/types/src/vscode/providers/FileTreeDataProvider.d.ts +0 -13
- package/dist/types/src/vscode/providers/ProcessesTreeDataProvider.d.ts +0 -23
- package/dist/types/src/vscode/providers/ResultsTreeDataProvider.d.ts +0 -10
- package/dist/types/src/vscode/providers/TestTreeDataProvider.d.ts +0 -16
- package/dist/types/src/vscode/types.d.ts +0 -14
- package/dist/types/testeranto/testeranto.d.ts +0 -3
- package/dist/types/tsconfig.types.tsbuildinfo +0 -1
- package/dist/vscode/extension.mjs +0 -5116
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import crypto from "crypto";
|
|
4
|
-
// Helper to compute a simple hash from file paths and contents
|
|
5
|
-
export async function computeFilesHash(files) {
|
|
6
|
-
const hash = crypto.createHash('md5');
|
|
7
|
-
for (const file of files) {
|
|
8
|
-
try {
|
|
9
|
-
const stats = fs.statSync(file);
|
|
10
|
-
hash.update(file);
|
|
11
|
-
hash.update(stats.mtimeMs.toString());
|
|
12
|
-
hash.update(stats.size.toString());
|
|
13
|
-
}
|
|
14
|
-
catch (error) {
|
|
15
|
-
// File may not exist, include its name anyway
|
|
16
|
-
hash.update(file);
|
|
17
|
-
hash.update('missing');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return hash.digest('hex');
|
|
21
|
-
}
|
|
22
|
-
// WebSocket functionality removed - dead feature
|
|
23
|
-
export async function sendSourceFilesUpdated(config, hash, files, testName, runtime) {
|
|
24
|
-
console.log(`[${runtime} Builder] WebSocket feature removed - not sending sourceFilesUpdated for ${testName}`);
|
|
25
|
-
return Promise.resolve();
|
|
26
|
-
}
|
|
27
|
-
// Extract input files from metafile recursively
|
|
28
|
-
export function extractInputFilesFromMetafile(metafile) {
|
|
29
|
-
const files = new Set();
|
|
30
|
-
if (!metafile || !metafile.inputs) {
|
|
31
|
-
return Array.from(files);
|
|
32
|
-
}
|
|
33
|
-
// Function to recursively collect all dependencies
|
|
34
|
-
function collectDependencies(filePath) {
|
|
35
|
-
if (files.has(filePath)) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
// Add the current file
|
|
39
|
-
files.add(filePath);
|
|
40
|
-
// Get file info from metafile
|
|
41
|
-
const fileInfo = metafile.inputs[filePath];
|
|
42
|
-
if (!fileInfo) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
// Recursively process each import
|
|
46
|
-
if (fileInfo.imports) {
|
|
47
|
-
for (const importInfo of fileInfo.imports) {
|
|
48
|
-
const importPath = importInfo.path;
|
|
49
|
-
// Only process if it's in the inputs (should be)
|
|
50
|
-
if (metafile.inputs[importPath]) {
|
|
51
|
-
collectDependencies(importPath);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Start from ALL files in inputs, not just entry points
|
|
57
|
-
// This ensures we get all transitive dependencies
|
|
58
|
-
for (const filePath of Object.keys(metafile.inputs)) {
|
|
59
|
-
collectDependencies(filePath);
|
|
60
|
-
}
|
|
61
|
-
// Convert to absolute paths
|
|
62
|
-
return Array.from(files).map(filePath => path.isAbsolute(filePath) ? filePath : path.resolve(process.cwd(), filePath));
|
|
63
|
-
}
|
|
64
|
-
export async function processMetafile(config, metafile, runtime) {
|
|
65
|
-
if (!metafile || !metafile.outputs) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
for (const [outputFile, outputInfo] of Object.entries(metafile.outputs)) {
|
|
69
|
-
const outputInfoTyped = outputInfo;
|
|
70
|
-
// Only process outputs that have an associated entryPoint
|
|
71
|
-
if (!outputInfoTyped.entryPoint) {
|
|
72
|
-
console.log(`[${runtime} Builder] Skipping output without entryPoint: ${outputFile}`);
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
// Get the entry point path
|
|
76
|
-
const entryPoint = outputInfoTyped.entryPoint;
|
|
77
|
-
// Only process test files (files ending with .test.ts, .test.js, .spec.ts, .spec.js)
|
|
78
|
-
// Also, exclude library files like src/lib/tiposkripto/Web.ts and src/lib/tiposkripto/Node.ts
|
|
79
|
-
const isTestFile = /\.(test|spec)\.(ts|js)$/.test(entryPoint);
|
|
80
|
-
if (!isTestFile) {
|
|
81
|
-
console.log(`[${runtime} Builder] Skipping non-test entryPoint: ${entryPoint}`);
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
// Get input files for this specific output
|
|
85
|
-
const outputInputs = outputInfoTyped.inputs || {};
|
|
86
|
-
// Function to recursively collect dependencies for a file
|
|
87
|
-
const collectedFiles = new Set();
|
|
88
|
-
function collectFileDependencies(filePath) {
|
|
89
|
-
var _a, _b;
|
|
90
|
-
if (collectedFiles.has(filePath)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
collectedFiles.add(filePath);
|
|
94
|
-
const fileInfo = (_a = metafile.inputs) === null || _a === void 0 ? void 0 : _a[filePath];
|
|
95
|
-
if (fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.imports) {
|
|
96
|
-
for (const importInfo of fileInfo.imports) {
|
|
97
|
-
const importPath = importInfo.path;
|
|
98
|
-
if ((_b = metafile.inputs) === null || _b === void 0 ? void 0 : _b[importPath]) {
|
|
99
|
-
collectFileDependencies(importPath);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
// Start from all files listed in this output's inputs
|
|
105
|
-
for (const inputFile of Object.keys(outputInputs)) {
|
|
106
|
-
collectFileDependencies(inputFile);
|
|
107
|
-
}
|
|
108
|
-
// Convert to absolute paths
|
|
109
|
-
const allInputFiles = Array.from(collectedFiles).map(filePath => path.isAbsolute(filePath) ? filePath : path.resolve(process.cwd(), filePath));
|
|
110
|
-
// Convert to relative paths from workspace root
|
|
111
|
-
const workspaceRoot = '/workspace';
|
|
112
|
-
const relativeFiles = allInputFiles.map(file => {
|
|
113
|
-
const absolutePath = path.isAbsolute(file) ? file : path.resolve(process.cwd(), file);
|
|
114
|
-
// Make path relative to workspace root
|
|
115
|
-
if (absolutePath.startsWith(workspaceRoot)) {
|
|
116
|
-
return absolutePath.slice(workspaceRoot.length);
|
|
117
|
-
}
|
|
118
|
-
// If not under workspace, use relative path from current directory
|
|
119
|
-
return path.relative(process.cwd(), absolutePath);
|
|
120
|
-
}).filter(Boolean);
|
|
121
|
-
// Write to file
|
|
122
|
-
const outputBaseName = entryPoint.split('.').slice(0, -1).join('.');
|
|
123
|
-
const inputFilesPath = `testeranto/bundles/allTests/${runtime}/${outputBaseName}.mjs-inputFiles.json`;
|
|
124
|
-
fs.writeFileSync(inputFilesPath, JSON.stringify(relativeFiles, null, 2));
|
|
125
|
-
console.log(`[${runtime} Builder] Wrote ${relativeFiles.length} input files to ${inputFilesPath}`);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
export const golangDockerComposeFile = (config, container_name) => {
|
|
2
|
-
return {
|
|
3
|
-
build: {
|
|
4
|
-
context: process.cwd(),
|
|
5
|
-
dockerfile: config[container_name].dockerfile,
|
|
6
|
-
},
|
|
7
|
-
container_name,
|
|
8
|
-
environment: {
|
|
9
|
-
// NODE_ENV: "production",
|
|
10
|
-
// ...config.env,
|
|
11
|
-
},
|
|
12
|
-
working_dir: "/workspace",
|
|
13
|
-
volumes: [
|
|
14
|
-
`${process.cwd()}/src:/workspace/src`,
|
|
15
|
-
`${process.cwd()}/example:/workspace/example`,
|
|
16
|
-
`${process.cwd()}/dist:/workspace/dist`,
|
|
17
|
-
`${process.cwd()}/testeranto:/workspace/testeranto`,
|
|
18
|
-
],
|
|
19
|
-
command: golangBuildCommand(),
|
|
20
|
-
};
|
|
21
|
-
// return {
|
|
22
|
-
// build: {
|
|
23
|
-
// context: process.cwd(), // Use the project root as build context
|
|
24
|
-
// dockerfile: config.golang.dockerfile,
|
|
25
|
-
// },
|
|
26
|
-
// container_name: `golang-builder-${projectName}`,
|
|
27
|
-
// environment: {
|
|
28
|
-
// ...config.env,
|
|
29
|
-
// },
|
|
30
|
-
// working_dir: "/workspace",
|
|
31
|
-
// volumes: [
|
|
32
|
-
// `${process.cwd()}:/workspace`,
|
|
33
|
-
// ],
|
|
34
|
-
// command: golangBuildCommand(),
|
|
35
|
-
// }
|
|
36
|
-
};
|
|
37
|
-
export const golangBuildCommand = () => {
|
|
38
|
-
return "go run src/server/runtimes/golang/main.go";
|
|
39
|
-
// return `go run src/server/runtimes/golang/golang.go /workspace/testeranto/runtimes/golang/golang.go`;
|
|
40
|
-
};
|
|
41
|
-
// this image "builds" test bundles. it is not a "docker build" thing
|
|
42
|
-
export const golangBddCommand = () => {
|
|
43
|
-
const jsonStr = JSON.stringify({ ports: [1111] });
|
|
44
|
-
return `go run example/cmd/calculator-test`;
|
|
45
|
-
};
|
|
46
|
-
export const golangTestCommand = (config, inputfiles) => {
|
|
47
|
-
var _a;
|
|
48
|
-
return `
|
|
49
|
-
${((_a = config.golang.checks) === null || _a === void 0 ? void 0 : _a.map((c) => {
|
|
50
|
-
return c(inputfiles);
|
|
51
|
-
}).join('\n')) || ''}
|
|
52
|
-
|
|
53
|
-
${golangBddCommand()}
|
|
54
|
-
`;
|
|
55
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const javaDockerComposeFile = (config, container_name, fpath) => {
|
|
2
|
-
return {
|
|
3
|
-
build: {
|
|
4
|
-
context: process.cwd(),
|
|
5
|
-
dockerfile: config[container_name].dockerfile,
|
|
6
|
-
},
|
|
7
|
-
container_name,
|
|
8
|
-
environment: Object.assign({ NODE_ENV: "production" }, config.env),
|
|
9
|
-
working_dir: "/workspace",
|
|
10
|
-
volumes: [
|
|
11
|
-
`${process.cwd()}/src:/workspace/src`,
|
|
12
|
-
`${process.cwd()}/example:/workspace/example`,
|
|
13
|
-
`${process.cwd()}/dist:/workspace/dist`,
|
|
14
|
-
`${process.cwd()}/testeranto:/workspace/testeranto`,
|
|
15
|
-
],
|
|
16
|
-
command: javaBuildCommand(fpath),
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export const javaBuildCommand = (fpath) => {
|
|
20
|
-
return `java src/server/runtimes/java/java.java /workspace/${fpath}`;
|
|
21
|
-
};
|
|
22
|
-
export const javaBddCommand = (fpath) => {
|
|
23
|
-
return `java testeranto/bundles/java/${fpath} /workspace/java.java`;
|
|
24
|
-
};
|
|
25
|
-
// export const javaBuildCommand = () => {
|
|
26
|
-
// return "cd /workspace && javac -cp \".:lib/*\" src/server/runtimes/java/main.java && java -cp \"src/server/runtimes/java:.\" main";
|
|
27
|
-
// }
|
|
28
|
-
// // this image "builds" test bundles. it is not a "docker build" thing
|
|
29
|
-
// export const javaBddCommand = () => {
|
|
30
|
-
// const jsonStr = JSON.stringify({ ports: [1111] });
|
|
31
|
-
// return `java -jar testeranto/bundles/allTests/java/example/Calculator-test.jar '${jsonStr}'`
|
|
32
|
-
// }
|
|
33
|
-
// export const javaTestCommand = (config: IBuiltConfig, inputfiles: string[]) => {
|
|
34
|
-
// return `
|
|
35
|
-
// ${config.java.checks?.map((c) => {
|
|
36
|
-
// return c(inputfiles);
|
|
37
|
-
// }).join('\n') || ''}
|
|
38
|
-
// ${javaBddCommand()}
|
|
39
|
-
// `;
|
|
40
|
-
// }
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export const nodeDockerComposeFile = (config, container_name, projectConfigPath, nodeConfigPath, testName) => {
|
|
2
|
-
return {
|
|
3
|
-
build: {
|
|
4
|
-
context: process.cwd(),
|
|
5
|
-
dockerfile: config[container_name].dockerfile,
|
|
6
|
-
},
|
|
7
|
-
container_name,
|
|
8
|
-
environment: Object.assign({ NODE_ENV: "production" }, config.env),
|
|
9
|
-
working_dir: "/workspace",
|
|
10
|
-
volumes: [
|
|
11
|
-
`${process.cwd()}/src:/workspace/src`,
|
|
12
|
-
`${process.cwd()}/example:/workspace/example`,
|
|
13
|
-
`${process.cwd()}/dist:/workspace/dist`,
|
|
14
|
-
`${process.cwd()}/testeranto:/workspace/testeranto`,
|
|
15
|
-
],
|
|
16
|
-
command: nodeBuildCommand(projectConfigPath, nodeConfigPath, testName),
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
const externalTests = true;
|
|
20
|
-
export const nodeBuildCommand = (projectConfigPath, nodeConfigPath, testName) => {
|
|
21
|
-
if (externalTests) {
|
|
22
|
-
console.log("external tests", testName);
|
|
23
|
-
// return `cat node_modules/testeranto/src/server/runtimes/node/esbuild.ts`
|
|
24
|
-
return `yarn tsx node_modules/testeranto/src/server/runtimes/node/node.ts /workspace/testeranto/testeranto.ts ${nodeConfigPath} ${testName}`;
|
|
25
|
-
// return `cat node_modules/testeranto/src/server/runtimes/node/node.ts`
|
|
26
|
-
// return ["sh", "-c", "cd /workspace && javac -cp \".:lib/*\" src/server/runtimes/java/main.java && java -cp \"src/server/runtimes/java:.\" main"]
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
console.log("not external tests");
|
|
30
|
-
// return `yarn tsx src/server/runtimes/node/node.ts /workspace/${fpath}`;
|
|
31
|
-
return `yarn tsx src/server/runtimes/node/node.ts /workspace/testeranto/testeranto.ts /workspace/${nodeConfigPath} ${testName}`;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
export const nodeBddCommand = (fpath) => {
|
|
35
|
-
return `node ${fpath.split('.').slice(0, -1).concat('mjs').join('.')} /workspace/node.js`;
|
|
36
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import featuresPlugin from "../../../esbuildConfigs/featuresPlugin.js";
|
|
2
|
-
import baseEsBuildConfig from "../../../esbuildConfigs/index.js";
|
|
3
|
-
import inputFilesPlugin from "../../../esbuildConfigs/inputFilesPlugin.js";
|
|
4
|
-
import rebuildPlugin from "../../../esbuildConfigs/rebuildPlugin.js";
|
|
5
|
-
const absoluteBundlesDir = () => {
|
|
6
|
-
return "./testeranto/bundles/allTests/node/";
|
|
7
|
-
};
|
|
8
|
-
export default (nodeConfig, testName, projectConfig) => {
|
|
9
|
-
var _a;
|
|
10
|
-
console.log("esbuild", testName, projectConfig);
|
|
11
|
-
const entryPoints = projectConfig.runtimes[testName].tests;
|
|
12
|
-
// Get entry points from config, or use a default
|
|
13
|
-
// let entrypoints: string[] = [];
|
|
14
|
-
// if (nodeConfig) {
|
|
15
|
-
// entrypoints = (projectConfig.tests);
|
|
16
|
-
// } else {
|
|
17
|
-
// // console.log(projectConfig)
|
|
18
|
-
// throw "projectConfig.node.tests should exist"
|
|
19
|
-
// // Fallback to a reasonable default
|
|
20
|
-
// // entrypoints = ["./example/Calculator.test.ts"];
|
|
21
|
-
// // console.warn(`No node.tests found in config, using default entry point: ${entrypoints[0]}`);
|
|
22
|
-
// }
|
|
23
|
-
const { inputFilesPluginFactory, register } = inputFilesPlugin("node", testName);
|
|
24
|
-
return Object.assign(Object.assign({}, baseEsBuildConfig(nodeConfig)), { outdir: absoluteBundlesDir(), outbase: ".", metafile: true, supported: {
|
|
25
|
-
"dynamic-import": true,
|
|
26
|
-
}, define: {
|
|
27
|
-
"process.env.FLUENTFFMPEG_COV": "0",
|
|
28
|
-
ENV: `"node"`,
|
|
29
|
-
}, bundle: true, format: "esm", absWorkingDir: process.cwd(), platform: "node", packages: "external", entryPoints, plugins: [
|
|
30
|
-
featuresPlugin,
|
|
31
|
-
inputFilesPluginFactory,
|
|
32
|
-
rebuildPlugin("node"),
|
|
33
|
-
...(((_a = nodeConfig.plugins) === null || _a === void 0 ? void 0 : _a.map((p) => p(register, entryPoints))) || []),
|
|
34
|
-
] });
|
|
35
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import { processMetafile } from "../common";
|
|
3
|
-
import nodeConfiger from "./esbuild";
|
|
4
|
-
console.log(`[NODE BUILDER] hello: ${process.argv}`);
|
|
5
|
-
const projectConfigPath = process.argv[2];
|
|
6
|
-
const nodeConfigPath = process.argv[3];
|
|
7
|
-
const testName = process.argv[4];
|
|
8
|
-
console.log(`[NODE BUILDER] projectConfigPath: ${projectConfigPath}`);
|
|
9
|
-
console.log(`[NODE BUILDER] nodeConfig: ${nodeConfigPath}`);
|
|
10
|
-
console.log(`[NODE BUILDER] testName: ${testName}`);
|
|
11
|
-
// run esbuild in watch mode using esbuildConfigs. Write to fs the bundle and metafile
|
|
12
|
-
async function startBundling(nodeConfigs, projectConfig) {
|
|
13
|
-
console.log(`[NODE BUILDER] is now bundling: ${testName}`);
|
|
14
|
-
const n = nodeConfiger(nodeConfigs, testName, projectConfig);
|
|
15
|
-
const buildResult = await esbuild.build(n);
|
|
16
|
-
// const metafilesDir =
|
|
17
|
-
// process.env.METAFILES_DIR || "/workspace/testeranto/metafiles/node";
|
|
18
|
-
if (buildResult.metafile) {
|
|
19
|
-
await processMetafile(projectConfig, buildResult.metafile, 'node');
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
console.warn("No metafile generated by esbuild");
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async function main() {
|
|
26
|
-
try {
|
|
27
|
-
const nodeConfigs = (await import(nodeConfigPath)).default;
|
|
28
|
-
const projectConfigs = (await import(projectConfigPath)).default;
|
|
29
|
-
await startBundling(nodeConfigs, projectConfigs);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
console.error("NODE BUILDER: Error importing config:", nodeConfigPath, error);
|
|
33
|
-
console.error(error);
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
main();
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export const pythonDockerComposeFile = (config, container_name, fpath) => {
|
|
2
|
-
return {
|
|
3
|
-
build: {
|
|
4
|
-
context: `${process.cwd()}/example`,
|
|
5
|
-
dockerfile: config[container_name].dockerfile,
|
|
6
|
-
},
|
|
7
|
-
container_name,
|
|
8
|
-
environment: Object.assign({ NODE_ENV: "production" }, config.env),
|
|
9
|
-
working_dir: "/workspace",
|
|
10
|
-
volumes: [
|
|
11
|
-
`${process.cwd()}/src:/workspace/src`,
|
|
12
|
-
`${process.cwd()}/example:/workspace/example`,
|
|
13
|
-
`${process.cwd()}/dist:/workspace/dist`,
|
|
14
|
-
`${process.cwd()}/testeranto:/workspace/testeranto`,
|
|
15
|
-
],
|
|
16
|
-
command: pythonBuildCommand(fpath),
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export const pythonBuildCommand = (fpath) => {
|
|
20
|
-
return `python src/server/runtimes/python/pitono.py /workspace/${fpath}`;
|
|
21
|
-
};
|
|
22
|
-
export const pythonBddCommand = (fpath) => {
|
|
23
|
-
const jsonStr = JSON.stringify({ ports: [1111] });
|
|
24
|
-
return `python ${fpath} '${jsonStr}'`;
|
|
25
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export const rubyDockerComposeFile = (config, container_name, fpath) => {
|
|
2
|
-
return {
|
|
3
|
-
build: {
|
|
4
|
-
context: process.cwd(),
|
|
5
|
-
dockerfile: config[container_name].dockerfile,
|
|
6
|
-
},
|
|
7
|
-
container_name,
|
|
8
|
-
environment: Object.assign({ NODE_ENV: "production" }, config.env),
|
|
9
|
-
working_dir: "/workspace",
|
|
10
|
-
volumes: [
|
|
11
|
-
`${process.cwd()}/src:/workspace/src`,
|
|
12
|
-
`${process.cwd()}/example:/workspace/example`,
|
|
13
|
-
`${process.cwd()}/dist:/workspace/dist`,
|
|
14
|
-
`${process.cwd()}/testeranto:/workspace/testeranto`,
|
|
15
|
-
],
|
|
16
|
-
command: rubyBuildCommand(fpath),
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export const rubyBuildCommand = (fpath) => {
|
|
20
|
-
console.log("mark 1", fpath);
|
|
21
|
-
return `ruby src/server/runtimes/ruby/ruby.rb /workspace/${fpath}`;
|
|
22
|
-
};
|
|
23
|
-
export const rubyBddCommand = (fpath) => {
|
|
24
|
-
// const jsonStr = JSON.stringify({ ports: [1111] });
|
|
25
|
-
// return `ruby example/Calculator-test.rb '${jsonStr}'`;
|
|
26
|
-
const jsonStr = JSON.stringify({ ports: [1111] });
|
|
27
|
-
return `ruby ${fpath} '${jsonStr}'`;
|
|
28
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export const rustDockerComposeFile = (config, container_name, fpath) => {
|
|
2
|
-
return {
|
|
3
|
-
build: {
|
|
4
|
-
context: `${process.cwd()}`,
|
|
5
|
-
dockerfile: config[container_name].dockerfile,
|
|
6
|
-
},
|
|
7
|
-
container_name,
|
|
8
|
-
environment: Object.assign({ NODE_ENV: "production" }, config.env),
|
|
9
|
-
working_dir: "/workspace",
|
|
10
|
-
volumes: [
|
|
11
|
-
`${process.cwd()}/src:/workspace/src`,
|
|
12
|
-
`${process.cwd()}/example:/workspace/example`,
|
|
13
|
-
`${process.cwd()}/dist:/workspace/dist`,
|
|
14
|
-
`${process.cwd()}/testeranto:/workspace/testeranto`,
|
|
15
|
-
],
|
|
16
|
-
command: rustBuildCommand(fpath),
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export const rustBuildCommand = (fpath) => {
|
|
20
|
-
// return `cat /workspace/testeranto/runtimes/rust/rust.rs`
|
|
21
|
-
// return `cat /workspace/${fpath}`
|
|
22
|
-
// return `echo "${fpath}"`
|
|
23
|
-
// return `CONFIG_PATH="/workspace/${fpath}" rustc src/server/runtimes/rust/main.rs -o my_program`;
|
|
24
|
-
return `sh -c "CONFIG_PATH=/workspace/${fpath} cargo build --release && ./target/release/my_program"`;
|
|
25
|
-
// return `tree`
|
|
26
|
-
};
|
|
27
|
-
export const rustBddCommand = (fpath) => {
|
|
28
|
-
return `rustc testeranto/bundles/rust/${fpath} /workspace/rust.rs`;
|
|
29
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export const webDockerComposeFile = (config, container_name, fpath) => {
|
|
2
|
-
return {
|
|
3
|
-
platform: "linux/arm64",
|
|
4
|
-
build: {
|
|
5
|
-
context: process.cwd(),
|
|
6
|
-
dockerfile: config[container_name].dockerfile,
|
|
7
|
-
},
|
|
8
|
-
container_name,
|
|
9
|
-
environment: {
|
|
10
|
-
// NODE_ENV: "production",
|
|
11
|
-
// ...config.env,
|
|
12
|
-
},
|
|
13
|
-
working_dir: "/workspace",
|
|
14
|
-
volumes: [
|
|
15
|
-
`${process.cwd()}/src:/workspace/src`,
|
|
16
|
-
`${process.cwd()}/example:/workspace/example`,
|
|
17
|
-
`${process.cwd()}/dist:/workspace/dist`,
|
|
18
|
-
`${process.cwd()}/testeranto:/workspace/testeranto`,
|
|
19
|
-
],
|
|
20
|
-
command: webBuildCommand(fpath),
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export const webBuildCommand = (fpath) => {
|
|
24
|
-
// return `yarn tsx src/server/runtimes/web/web.ts /workspace/${fpath}`;
|
|
25
|
-
return `yarn tsx src/server/runtimes/web/web.ts /workspace/${fpath}`;
|
|
26
|
-
};
|
|
27
|
-
export const webBddCommand = (fpath) => {
|
|
28
|
-
// return `node ${fpath} /workspace/web.js `;x
|
|
29
|
-
return `node dist/prebuild/server/runtimes/web/hoist.mjs `;
|
|
30
|
-
};
|
|
31
|
-
// export const webBuildCommand = () => {
|
|
32
|
-
// return `yarn tsx src/server/runtimes/web/web.ts testeranto/runtimes/web/web.js`
|
|
33
|
-
// }
|
|
34
|
-
// export const webBddCommand = () => {
|
|
35
|
-
// return `yarn tsx src/server/runtimes/web/hoist.ts testeranto/bundles/allTests/web/example/Calculator.test.mjs`
|
|
36
|
-
// }
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import featuresPlugin from "../../../esbuildConfigs/featuresPlugin.js";
|
|
2
|
-
import baseEsBuildConfig from "../../../esbuildConfigs/index.js";
|
|
3
|
-
import inputFilesPlugin from "../../../esbuildConfigs/inputFilesPlugin.js";
|
|
4
|
-
import rebuildPlugin from "../../../esbuildConfigs/rebuildPlugin.js";
|
|
5
|
-
const absoluteBundlesDir = (c) => {
|
|
6
|
-
return "./testeranto/bundles/allTests/web/";
|
|
7
|
-
};
|
|
8
|
-
export default (config, testName) => {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
// Use the same entry points as node tests for consistency
|
|
11
|
-
const entrypoints = ["./example/Calculator.test.ts"];
|
|
12
|
-
const { inputFilesPluginFactory, register } = inputFilesPlugin("web", testName);
|
|
13
|
-
return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { outdir: absoluteBundlesDir(config), outbase: ".", metafile: true, supported: {
|
|
14
|
-
"dynamic-import": true,
|
|
15
|
-
}, define: {
|
|
16
|
-
"process.env.FLUENTFFMPEG_COV": "0",
|
|
17
|
-
ENV: `"web"`,
|
|
18
|
-
}, absWorkingDir: process.cwd(), platform: "browser", packages: "external", entryPoints: entrypoints, bundle: true, format: "esm", plugins: [
|
|
19
|
-
featuresPlugin,
|
|
20
|
-
inputFilesPluginFactory,
|
|
21
|
-
rebuildPlugin("web"),
|
|
22
|
-
...(((_b = (_a = config.web) === null || _a === void 0 ? void 0 : _a.plugins) === null || _b === void 0 ? void 0 : _b.map((p) => p(register, entrypoints))) || []),
|
|
23
|
-
] });
|
|
24
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import puppeteer from 'puppeteer';
|
|
2
|
-
async function main() {
|
|
3
|
-
const browser = await puppeteer.connect({
|
|
4
|
-
browserURL: 'http://web-builder:9222'
|
|
5
|
-
});
|
|
6
|
-
const page = await browser.newPage();
|
|
7
|
-
await page.goto('about:blank');
|
|
8
|
-
await browser.disconnect();
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
main();
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import esbuild from "esbuild";
|
|
2
|
-
import puppeteer from "puppeteer";
|
|
3
|
-
import configer from "./esbuild";
|
|
4
|
-
import { processMetafile } from "../common";
|
|
5
|
-
import * as fs from "fs";
|
|
6
|
-
import * as path from "path";
|
|
7
|
-
const configFilePath = process.argv[2];
|
|
8
|
-
// const configFilePath = "/workspace/testeranto/runtimes/web/web.js"; //path.join(process.cwd(), 'testeranto/runtimes/web/web.js'); //process.argv[2];
|
|
9
|
-
const testName = process.argv[3] || "allTests";
|
|
10
|
-
// let browser: puppeteer.Browser;
|
|
11
|
-
async function startBundling(config) {
|
|
12
|
-
console.log(`[WEB BUILDER] is now bundling: ${testName}`);
|
|
13
|
-
// Validate config
|
|
14
|
-
if (!config) {
|
|
15
|
-
throw new Error('Config is undefined');
|
|
16
|
-
}
|
|
17
|
-
if (!config.buildDir) {
|
|
18
|
-
console.warn('config.buildDir is undefined, using default');
|
|
19
|
-
config.buildDir = '/workspace';
|
|
20
|
-
}
|
|
21
|
-
console.log(`Using build directory: ${config.buildDir}`);
|
|
22
|
-
// Proceed with bundling
|
|
23
|
-
const webConfig = configer(config, 'allTests');
|
|
24
|
-
// Build the web bundle
|
|
25
|
-
const buildResult = await esbuild.build(webConfig);
|
|
26
|
-
if (buildResult.metafile) {
|
|
27
|
-
await processMetafile(config, buildResult.metafile, 'web');
|
|
28
|
-
// Create HTML files for each output
|
|
29
|
-
const outputFiles = Object.keys(buildResult.metafile.outputs);
|
|
30
|
-
for (const outputFile of outputFiles) {
|
|
31
|
-
if (true) {
|
|
32
|
-
const htmlPath = `testeranto/bundles/allTests/web/example/Calculator.test.ts.html`;
|
|
33
|
-
// Ensure the directory exists
|
|
34
|
-
await fs.promises.mkdir(path.dirname(htmlPath), { recursive: true });
|
|
35
|
-
// Create HTML content
|
|
36
|
-
const htmlContent = `<!DOCTYPE html>
|
|
37
|
-
<html>
|
|
38
|
-
<head>
|
|
39
|
-
<meta charset="UTF-8">
|
|
40
|
-
<title>Test Runner</title>
|
|
41
|
-
</head>
|
|
42
|
-
<body>
|
|
43
|
-
<div id="root"></div>
|
|
44
|
-
<script src="testeranto/bundles/allTests/web/example/Calculator.test.mjs"></script>
|
|
45
|
-
</body>
|
|
46
|
-
</html>`;
|
|
47
|
-
await fs.promises.writeFile(htmlPath, htmlContent);
|
|
48
|
-
console.log(`Created HTML file: ${htmlPath}`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
console.warn("No metafile generated by esbuild");
|
|
54
|
-
}
|
|
55
|
-
console.log("WEB BUILDER: Metafiles have been generated");
|
|
56
|
-
// TODO FIXME
|
|
57
|
-
// In dev mode, keep the process alive
|
|
58
|
-
if ("dev" === "dev") {
|
|
59
|
-
console.log("WEB BUILDER: Running in dev mode, keeping builder alive...");
|
|
60
|
-
// Watch for changes to rebuild metafiles
|
|
61
|
-
const ctx = await esbuild.context(webConfig);
|
|
62
|
-
let { hosts, port } = await ctx.serve();
|
|
63
|
-
console.log(`[WEB BUILDER]: esbuild server ${hosts}, ${port}`);
|
|
64
|
-
// Keep the process alive
|
|
65
|
-
process.on("SIGINT", async () => {
|
|
66
|
-
console.log("WEB BUILDER: Shutting down...");
|
|
67
|
-
process.exit(0);
|
|
68
|
-
});
|
|
69
|
-
try {
|
|
70
|
-
const browser = await puppeteer.launch({
|
|
71
|
-
// Flags required for Docker/Alpine compatibility
|
|
72
|
-
args: [
|
|
73
|
-
'--no-sandbox',
|
|
74
|
-
'--disable-setuid-sandbox',
|
|
75
|
-
'--disable-dev-shm-usage', // Prevents crashes in low-memory Docker envs
|
|
76
|
-
'--disable-gpu',
|
|
77
|
-
'--single-process', // Run in a single process
|
|
78
|
-
'--no-zygote', // Disable zygote process
|
|
79
|
-
'--disable-background-timer-throttling', // Disable throttling of timers in background pages
|
|
80
|
-
'--disable-backgrounding-occluded-windows', // Disable backgrounding of occluded windows
|
|
81
|
-
'--disable-renderer-backgrounding', // Disable backgrounding renders
|
|
82
|
-
'--remote-debugging-address=0.0.0.0', // Allow remote debugging
|
|
83
|
-
'--remote-debugging-port=9222' // Set remote debugging port
|
|
84
|
-
],
|
|
85
|
-
// Automatically uses ENV PUPPETEER_EXECUTABLE_PATH
|
|
86
|
-
executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || '/usr/bin/chromium-browser',
|
|
87
|
-
headless: true, // Run in headless mode
|
|
88
|
-
timeout: 60000 // Increase timeout to 60 seconds
|
|
89
|
-
});
|
|
90
|
-
console.log("Puppeteer launched successfully");
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
console.error("Failed to launch Puppeteer:", error);
|
|
94
|
-
process.exit(1);
|
|
95
|
-
}
|
|
96
|
-
// Keep alive
|
|
97
|
-
await new Promise(() => {
|
|
98
|
-
// This promise never resolves, keeping the process alive
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
async function main() {
|
|
103
|
-
try {
|
|
104
|
-
console.log(`[WEB BUILDER] Importing config from: ${configFilePath}`);
|
|
105
|
-
const imported = await import(configFilePath);
|
|
106
|
-
const config = imported.default;
|
|
107
|
-
if (!config) {
|
|
108
|
-
throw new Error(`Config not found in ${configFilePath}. Ensure the file exports a default object.`);
|
|
109
|
-
}
|
|
110
|
-
console.log('[WEB BUILDER] Config imported successfully:', Object.keys(config));
|
|
111
|
-
await startBundling(config);
|
|
112
|
-
console.log(`[WEB BUILDER] Puppeteer is running: ${puppeteer}`);
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
console.error(error);
|
|
116
|
-
process.exit(1);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
main();
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import readline from "readline";
|
|
3
|
-
import { Server_Docker } from "./Server_Docker";
|
|
4
|
-
console.log("hello server");
|
|
5
|
-
readline.emitKeypressEvents(process.stdin);
|
|
6
|
-
if (process.stdin.isTTY)
|
|
7
|
-
process.stdin.setRawMode(true);
|
|
8
|
-
export class Server extends Server_Docker {
|
|
9
|
-
constructor(configs, mode) {
|
|
10
|
-
super(configs, mode);
|
|
11
|
-
console.log(("[Server] Press 'q' to initiate a graceful shutdown."));
|
|
12
|
-
console.log(("[Server] Press 'CTRL + c' to quit forcefully."));
|
|
13
|
-
process.stdin.on("keypress", async (str, key) => {
|
|
14
|
-
if (key.name === "q") {
|
|
15
|
-
console.log("Testeranto is shutting down gracefully...");
|
|
16
|
-
await this.stop();
|
|
17
|
-
process.exit(0);
|
|
18
|
-
}
|
|
19
|
-
// Handle Ctrl+C through keypress when in raw mode
|
|
20
|
-
if (key.ctrl && key.name === "c") {
|
|
21
|
-
console.log("\nForce quitting...");
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
process.on("SIGINT", async () => {
|
|
26
|
-
console.log("\nForce quitting...");
|
|
27
|
-
process.exit(1);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
async start() {
|
|
31
|
-
console.log(`[Server] start()`);
|
|
32
|
-
const runtimesDir = `testeranto/runtimes/`;
|
|
33
|
-
fs.mkdirSync(runtimesDir, { recursive: true });
|
|
34
|
-
await super.start();
|
|
35
|
-
}
|
|
36
|
-
async stop() {
|
|
37
|
-
console.log(`[Server] stop()`);
|
|
38
|
-
await super.stop();
|
|
39
|
-
}
|
|
40
|
-
}
|