testeranto 0.219.15 → 0.219.17

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.
Files changed (110) hide show
  1. package/bundle.js +3 -2
  2. package/dist/common/package.json +3 -0
  3. package/dist/module/package.json +3 -0
  4. package/dist/prebuild/chunk-QLT7PNPK.mjs +162 -0
  5. package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +20 -0
  6. package/dist/prebuild/init-docs.mjs +56 -0
  7. package/dist/prebuild/server/runtimes/node/node.mjs +80 -0
  8. package/dist/prebuild/server/runtimes/web/hoist.mjs +12 -0
  9. package/dist/prebuild/server/runtimes/web/web.mjs +162 -0
  10. package/dist/prebuild/testeranto.mjs +1691 -0
  11. package/dist/vscode/extension.mjs +5116 -0
  12. package/package.json +19 -18
  13. package/src/Types.ts +12 -170
  14. package/src/lib/tiposkripto/bundle.js +26 -0
  15. package/src/lib/tiposkripto/cjs-shim.js +14 -0
  16. package/src/lib/tiposkripto/dist/common/Types.js +2 -0
  17. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/BaseGiven.js +96 -0
  18. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/BaseSuite.js +134 -0
  19. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/BaseThen.js +65 -0
  20. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/BaseTiposkripto.js +194 -0
  21. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/BaseWhen.js +46 -0
  22. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/CoreTypes.js +2 -0
  23. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/Node.js +40 -0
  24. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/Web.js +70 -0
  25. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/index.mjs +48 -0
  26. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/src/types.js +6 -0
  27. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/tests/abstractBase.test/MockGiven.js +22 -0
  28. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/tests/abstractBase.test/MockThen.js +16 -0
  29. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/tests/abstractBase.test/MockWhen.js +18 -0
  30. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/tests/abstractBase.test/adapter.js +24 -0
  31. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/tests/abstractBase.test/implementation.js +38 -0
  32. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/tests/abstractBase.test/index.js +17 -0
  33. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/tests/abstractBase.test/specification.js +19 -0
  34. package/src/lib/tiposkripto/dist/common/lib/tiposkripto/tests/abstractBase.test/types.js +2 -0
  35. package/src/lib/tiposkripto/dist/common/package.json +3 -0
  36. package/src/lib/tiposkripto/dist/common/tsconfig.common.tsbuildinfo +1 -0
  37. package/src/lib/tiposkripto/dist/module/Types.js +1 -0
  38. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/BaseGiven.js +92 -0
  39. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/BaseSuite.js +130 -0
  40. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/BaseThen.js +61 -0
  41. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/BaseTiposkripto.js +191 -0
  42. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/BaseWhen.js +42 -0
  43. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/CoreTypes.js +1 -0
  44. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/Node.js +33 -0
  45. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/Web.js +63 -0
  46. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/index.mjs +47 -0
  47. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/src/types.js +3 -0
  48. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/tests/abstractBase.test/MockGiven.js +18 -0
  49. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/tests/abstractBase.test/MockThen.js +12 -0
  50. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/tests/abstractBase.test/MockWhen.js +14 -0
  51. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/tests/abstractBase.test/adapter.js +21 -0
  52. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/tests/abstractBase.test/implementation.js +35 -0
  53. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/tests/abstractBase.test/index.js +12 -0
  54. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/tests/abstractBase.test/specification.js +15 -0
  55. package/src/lib/tiposkripto/dist/module/lib/tiposkripto/tests/abstractBase.test/types.js +1 -0
  56. package/src/lib/tiposkripto/dist/module/package.json +3 -0
  57. package/src/lib/tiposkripto/dist/module/tsconfig.module.tsbuildinfo +1 -0
  58. package/src/lib/tiposkripto/dist/prebuild/Node-KZP3KCHY.mjs +53 -0
  59. package/src/lib/tiposkripto/dist/prebuild/Web-N3U4GGVG.mjs +77 -0
  60. package/src/lib/tiposkripto/dist/prebuild/chunk-IWCYUFDQ.mjs +539 -0
  61. package/src/lib/tiposkripto/dist/prebuild/chunk-MABQI2BP.mjs +57 -0
  62. package/src/lib/tiposkripto/dist/prebuild/index.mjs +10 -0
  63. package/src/lib/tiposkripto/dist/types/Types.d.ts +63 -0
  64. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/BaseGiven.d.ts +42 -0
  65. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/BaseSuite.d.ts +46 -0
  66. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/BaseThen.d.ts +28 -0
  67. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/BaseTiposkripto.d.ts +35 -0
  68. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/BaseWhen.d.ts +27 -0
  69. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/CoreTypes.d.ts +55 -0
  70. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/Node.d.ts +9 -0
  71. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/Web.d.ts +9 -0
  72. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/index.d.mts +8 -0
  73. package/src/lib/tiposkripto/dist/types/lib/tiposkripto/src/types.d.ts +60 -0
  74. package/src/lib/tiposkripto/dist/types/tsconfig.types.tsbuildinfo +1 -0
  75. package/src/lib/tiposkripto/package.json +16 -7
  76. package/src/lib/tiposkripto/postBuild.sh +11 -0
  77. package/src/lib/tiposkripto/prebuild.sh +1 -0
  78. package/src/lib/tiposkripto/{BaseGiven.ts → src/BaseGiven.ts} +2 -2
  79. package/src/lib/tiposkripto/{BaseSuite.ts → src/BaseSuite.ts} +3 -2
  80. package/src/lib/tiposkripto/{BaseThen.ts → src/BaseThen.ts} +2 -2
  81. package/src/lib/tiposkripto/{BaseTiposkripto.ts → src/BaseTiposkripto.ts} +6 -19
  82. package/src/lib/tiposkripto/{BaseWhen.ts → src/BaseWhen.ts} +1 -1
  83. package/src/lib/tiposkripto/{CoreTypes.ts → src/CoreTypes.ts} +18 -16
  84. package/src/lib/tiposkripto/{Node.ts → src/Node.ts} +6 -16
  85. package/src/lib/tiposkripto/{Web.ts → src/Web.ts} +4 -7
  86. package/src/lib/tiposkripto/src/index.ts +107 -0
  87. package/src/lib/tiposkripto/{index.ts → src/types.ts} +20 -44
  88. package/src/lib/tiposkripto/{abstractBase.test → tests/abstractBase.test}/MockGiven.ts +1 -1
  89. package/src/lib/tiposkripto/{abstractBase.test → tests/abstractBase.test}/MockThen.ts +1 -1
  90. package/src/lib/tiposkripto/{abstractBase.test → tests/abstractBase.test}/MockWhen.ts +1 -1
  91. package/src/lib/tiposkripto/{abstractBase.test → tests/abstractBase.test}/adapter.ts +1 -1
  92. package/src/lib/tiposkripto/{abstractBase.test → tests/abstractBase.test}/index.ts +1 -1
  93. package/src/lib/tiposkripto/tsconfig.common.json +45 -0
  94. package/src/lib/tiposkripto/tsconfig.json +61 -0
  95. package/src/lib/tiposkripto/tsconfig.module.json +46 -0
  96. package/src/lib/tiposkripto/tsconfig.types.json +47 -0
  97. package/src/server/getRunnables.ts +1 -1
  98. package/src/server/runtimes/node/docker.ts +7 -4
  99. package/src/server/runtimes/node/esbuild.ts +2 -1
  100. package/src/server/runtimes/node/node.ts +2 -1
  101. package/src/server/serverClasees/Server_Docker.ts +3 -3
  102. package/src/server/types.ts +10 -1
  103. package/src/testeranto.ts +1 -36
  104. package/testeranto/docker-compose.yml +1 -201
  105. package/testeranto/testeranto.ts +60 -60
  106. package/src/lib/tiposkripto/Tiposkripto.ts +0 -47
  107. package/src/lib/tiposkripto/types.ts +0 -23
  108. /package/src/lib/tiposkripto/{abstractBase.test → tests/abstractBase.test}/implementation.ts +0 -0
  109. /package/src/lib/tiposkripto/{abstractBase.test → tests/abstractBase.test}/specification.ts +0 -0
  110. /package/src/lib/tiposkripto/{abstractBase.test → tests/abstractBase.test}/types.ts +0 -0
package/bundle.js CHANGED
@@ -1,5 +1,6 @@
1
- import * as fs from 'fs';
2
- import * as path from 'path';
1
+
2
+ import fs from "fs"
3
+ import path from "path"
3
4
  import * as esbuild from 'esbuild'
4
5
 
5
6
  // Build main application
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,162 @@
1
+ // src/server/runtimes/common.ts
2
+ import path from "path";
3
+ import fs from "fs";
4
+ import crypto from "crypto";
5
+ async function processMetafile(config, metafile, runtime) {
6
+ if (!metafile || !metafile.outputs) {
7
+ return;
8
+ }
9
+ for (const [outputFile, outputInfo] of Object.entries(metafile.outputs)) {
10
+ let collectFileDependencies2 = function(filePath) {
11
+ if (collectedFiles.has(filePath)) {
12
+ return;
13
+ }
14
+ collectedFiles.add(filePath);
15
+ const fileInfo = metafile.inputs?.[filePath];
16
+ if (fileInfo?.imports) {
17
+ for (const importInfo of fileInfo.imports) {
18
+ const importPath = importInfo.path;
19
+ if (metafile.inputs?.[importPath]) {
20
+ collectFileDependencies2(importPath);
21
+ }
22
+ }
23
+ }
24
+ };
25
+ var collectFileDependencies = collectFileDependencies2;
26
+ const outputInfoTyped = outputInfo;
27
+ if (!outputInfoTyped.entryPoint) {
28
+ console.log(`[${runtime} Builder] Skipping output without entryPoint: ${outputFile}`);
29
+ continue;
30
+ }
31
+ const entryPoint = outputInfoTyped.entryPoint;
32
+ const isTestFile = /\.(test|spec)\.(ts|js)$/.test(entryPoint);
33
+ if (!isTestFile) {
34
+ console.log(`[${runtime} Builder] Skipping non-test entryPoint: ${entryPoint}`);
35
+ continue;
36
+ }
37
+ const outputInputs = outputInfoTyped.inputs || {};
38
+ const collectedFiles = /* @__PURE__ */ new Set();
39
+ for (const inputFile of Object.keys(outputInputs)) {
40
+ collectFileDependencies2(inputFile);
41
+ }
42
+ const allInputFiles = Array.from(collectedFiles).map(
43
+ (filePath) => path.isAbsolute(filePath) ? filePath : path.resolve(process.cwd(), filePath)
44
+ );
45
+ const workspaceRoot = "/workspace";
46
+ const relativeFiles = allInputFiles.map((file) => {
47
+ const absolutePath = path.isAbsolute(file) ? file : path.resolve(process.cwd(), file);
48
+ if (absolutePath.startsWith(workspaceRoot)) {
49
+ return absolutePath.slice(workspaceRoot.length);
50
+ }
51
+ return path.relative(process.cwd(), absolutePath);
52
+ }).filter(Boolean);
53
+ const outputBaseName = entryPoint.split(".").slice(0, -1).join(".");
54
+ const inputFilesPath = `testeranto/bundles/allTests/${runtime}/${outputBaseName}.mjs-inputFiles.json`;
55
+ fs.writeFileSync(inputFilesPath, JSON.stringify(relativeFiles, null, 2));
56
+ console.log(`[${runtime} Builder] Wrote ${relativeFiles.length} input files to ${inputFilesPath}`);
57
+ }
58
+ }
59
+
60
+ // src/esbuildConfigs/featuresPlugin.ts
61
+ import path2 from "path";
62
+ var featuresPlugin_default = {
63
+ name: "feature-markdown",
64
+ setup(build) {
65
+ build.onResolve({ filter: /\.md$/ }, (args) => {
66
+ if (args.resolveDir === "") return;
67
+ return {
68
+ path: path2.isAbsolute(args.path) ? args.path : path2.join(args.resolveDir, args.path),
69
+ namespace: "feature-markdown"
70
+ };
71
+ });
72
+ build.onLoad(
73
+ { filter: /.*/, namespace: "feature-markdown" },
74
+ async (args) => {
75
+ return {
76
+ contents: `file://${args.path}`,
77
+ loader: "text"
78
+ // contents: JSON.stringify({ path: args.path }),
79
+ // loader: "json",
80
+ // contents: JSON.stringify({
81
+ // // html: markdownHTML,
82
+ // raw: markdownContent,
83
+ // filename: args.path, //path.basename(args.path),
84
+ // }),
85
+ // loader: "json",
86
+ };
87
+ }
88
+ );
89
+ }
90
+ };
91
+
92
+ // src/esbuildConfigs/index.ts
93
+ var esbuildConfigs_default = (config) => {
94
+ return {
95
+ // packages: "external",
96
+ target: "esnext",
97
+ format: "esm",
98
+ splitting: true,
99
+ outExtension: { ".js": ".mjs" },
100
+ outbase: ".",
101
+ jsx: "transform",
102
+ bundle: true,
103
+ // minify: config.minify === true,
104
+ write: true,
105
+ loader: {
106
+ ".js": "jsx",
107
+ ".png": "binary",
108
+ ".jpg": "binary"
109
+ }
110
+ };
111
+ };
112
+
113
+ // src/esbuildConfigs/inputFilesPlugin.ts
114
+ import fs2 from "fs";
115
+ var otherInputs = {};
116
+ var register = (entrypoint, sources) => {
117
+ if (!otherInputs[entrypoint]) {
118
+ otherInputs[entrypoint] = /* @__PURE__ */ new Set();
119
+ }
120
+ sources.forEach((s) => otherInputs[entrypoint].add(s));
121
+ };
122
+ var inputFilesPlugin_default = (platform, testName) => {
123
+ const f = `${testName}`;
124
+ return {
125
+ register,
126
+ inputFilesPluginFactory: {
127
+ name: "metafileWriter",
128
+ setup(build) {
129
+ build.onEnd((result) => {
130
+ fs2.writeFileSync(f, JSON.stringify(result, null, 2));
131
+ });
132
+ }
133
+ }
134
+ };
135
+ };
136
+
137
+ // src/esbuildConfigs/rebuildPlugin.ts
138
+ import fs3 from "fs";
139
+ var rebuildPlugin_default = (r) => {
140
+ return {
141
+ name: "rebuild-notify",
142
+ setup: (build) => {
143
+ build.onEnd((result) => {
144
+ console.log(`${r} > build ended with ${result.errors.length} errors`);
145
+ if (result.errors.length > 0) {
146
+ fs3.writeFileSync(
147
+ `./testeranto/reports${r}_build_errors`,
148
+ JSON.stringify(result, null, 2)
149
+ );
150
+ }
151
+ });
152
+ }
153
+ };
154
+ };
155
+
156
+ export {
157
+ processMetafile,
158
+ featuresPlugin_default,
159
+ esbuildConfigs_default,
160
+ inputFilesPlugin_default,
161
+ rebuildPlugin_default
162
+ };
@@ -0,0 +1,20 @@
1
+ // src/esbuildConfigs/eslint-formatter-testeranto.ts
2
+ function eslint_formatter_testeranto_default(results) {
3
+ return results.filter((r) => r.messages.length).map((r) => {
4
+ const path = r.filePath.replace(process.cwd() + "/", "");
5
+ return [
6
+ path,
7
+ ...r.messages.map(
8
+ (m) => [
9
+ `${m.line}:${m.column} ${m.message} (${m.ruleId || ""})`,
10
+ ...m.suggestions?.map(
11
+ (s) => `- ${s.message}${s.fix ? " (fix)" : ""}`
12
+ ) || []
13
+ ].join("\n")
14
+ )
15
+ ].join("\n");
16
+ }).join("\n\n");
17
+ }
18
+ export {
19
+ eslint_formatter_testeranto_default as default
20
+ };
@@ -0,0 +1,56 @@
1
+ // src/Init.ts
2
+ import fs from "fs";
3
+ var Init_default = async () => {
4
+ [
5
+ `testeranto/`,
6
+ `testeranto/bundles/`,
7
+ `testeranto/bundles/node`,
8
+ `testeranto/bundles/web`,
9
+ `testeranto/bundles/pure`,
10
+ `testeranto/bundles/golang`,
11
+ `testeranto/bundles/python`,
12
+ `testeranto/reports/`,
13
+ `testeranto/features/`,
14
+ `testeranto/metafiles/`,
15
+ `testeranto/metafiles/node`,
16
+ `testeranto/metafiles/web`,
17
+ `testeranto/metafiles/pure`,
18
+ `testeranto/metafiles/golang`,
19
+ `testeranto/metafiles/python`
20
+ ].forEach((f) => {
21
+ try {
22
+ fs.mkdirSync(`${process.cwd()}/${f}`);
23
+ } catch (e) {
24
+ console.error(e);
25
+ }
26
+ });
27
+ fs.copyFileSync(
28
+ `node_modules/testeranto/dist/prebuild/Report.js`,
29
+ `testeranto/Report.js`
30
+ );
31
+ fs.copyFileSync(
32
+ `node_modules/testeranto/dist/prebuild/Report.css`,
33
+ `testeranto/Report.css`
34
+ );
35
+ fs.copyFileSync(
36
+ `node_modules/testeranto/dist/prebuild/ProcessManager.js`,
37
+ `testeranto/ProcessManager.js`
38
+ );
39
+ fs.copyFileSync(
40
+ `node_modules/testeranto/dist/prebuild/ProcessManager.css`,
41
+ `testeranto/ProcessManager.css`
42
+ );
43
+ fs.copyFileSync(
44
+ `node_modules/testeranto/dist/prebuild/Features.js`,
45
+ `testeranto/ProcessManager.js`
46
+ );
47
+ fs.copyFileSync(
48
+ `node_modules/testeranto/dist/prebuild/Features.css`,
49
+ `testeranto/ProcessManager.css`
50
+ );
51
+ };
52
+
53
+ // src/init-docs.ts
54
+ console.log("Initializing a testeranto project");
55
+ Init_default();
56
+ console.log("testeranto project initialized");
@@ -0,0 +1,80 @@
1
+ import {
2
+ esbuildConfigs_default,
3
+ featuresPlugin_default,
4
+ inputFilesPlugin_default,
5
+ processMetafile,
6
+ rebuildPlugin_default
7
+ } from "../../../chunk-QLT7PNPK.mjs";
8
+
9
+ // src/server/runtimes/node/node.ts
10
+ import esbuild from "esbuild";
11
+
12
+ // src/server/runtimes/node/esbuild.ts
13
+ var absoluteBundlesDir = () => {
14
+ return "./testeranto/bundles/allTests/node/";
15
+ };
16
+ var esbuild_default = (nodeConfig, testName2, projectConfig) => {
17
+ console.log("esbuild", testName2, projectConfig);
18
+ const entryPoints = projectConfig.runtimes[testName2].tests;
19
+ const { inputFilesPluginFactory, register } = inputFilesPlugin_default(
20
+ "node",
21
+ testName2
22
+ );
23
+ return {
24
+ ...esbuildConfigs_default(nodeConfig),
25
+ outdir: absoluteBundlesDir(),
26
+ outbase: ".",
27
+ // Preserve directory structure relative to outdir
28
+ metafile: true,
29
+ supported: {
30
+ "dynamic-import": true
31
+ },
32
+ define: {
33
+ "process.env.FLUENTFFMPEG_COV": "0",
34
+ ENV: `"node"`
35
+ },
36
+ bundle: true,
37
+ format: "esm",
38
+ absWorkingDir: process.cwd(),
39
+ platform: "node",
40
+ packages: "external",
41
+ entryPoints,
42
+ plugins: [
43
+ featuresPlugin_default,
44
+ inputFilesPluginFactory,
45
+ rebuildPlugin_default("node"),
46
+ ...nodeConfig.plugins?.map((p) => p(register, entryPoints)) || []
47
+ ]
48
+ };
49
+ };
50
+
51
+ // src/server/runtimes/node/node.ts
52
+ console.log(`[NODE BUILDER] hello: ${process.argv}`);
53
+ var projectConfigPath = process.argv[2];
54
+ var nodeConfigPath = process.argv[3];
55
+ var testName = process.argv[4];
56
+ console.log(`[NODE BUILDER] projectConfigPath: ${projectConfigPath}`);
57
+ console.log(`[NODE BUILDER] nodeConfig: ${nodeConfigPath}`);
58
+ console.log(`[NODE BUILDER] testName: ${testName}`);
59
+ async function startBundling(nodeConfigs, projectConfig) {
60
+ console.log(`[NODE BUILDER] is now bundling: ${testName}`);
61
+ const n = esbuild_default(nodeConfigs, testName, projectConfig);
62
+ const buildResult = await esbuild.build(n);
63
+ if (buildResult.metafile) {
64
+ await processMetafile(projectConfig, buildResult.metafile, "node");
65
+ } else {
66
+ console.warn("No metafile generated by esbuild");
67
+ }
68
+ }
69
+ async function main() {
70
+ try {
71
+ const nodeConfigs = (await import(nodeConfigPath)).default;
72
+ const projectConfigs = (await import(projectConfigPath)).default;
73
+ await startBundling(nodeConfigs, projectConfigs);
74
+ } catch (error) {
75
+ console.error("NODE BUILDER: Error importing config:", nodeConfigPath, error);
76
+ console.error(error);
77
+ process.exit(1);
78
+ }
79
+ }
80
+ main();
@@ -0,0 +1,12 @@
1
+ // src/server/runtimes/web/hoist.ts
2
+ import puppeteer from "puppeteer";
3
+ async function main() {
4
+ const browser = await puppeteer.connect({
5
+ browserURL: "http://web-builder:9222"
6
+ });
7
+ const page = await browser.newPage();
8
+ await page.goto("about:blank");
9
+ await browser.disconnect();
10
+ return;
11
+ }
12
+ main();
@@ -0,0 +1,162 @@
1
+ import {
2
+ esbuildConfigs_default,
3
+ featuresPlugin_default,
4
+ inputFilesPlugin_default,
5
+ processMetafile,
6
+ rebuildPlugin_default
7
+ } from "../../../chunk-QLT7PNPK.mjs";
8
+
9
+ // src/server/runtimes/web/web.ts
10
+ import esbuild from "esbuild";
11
+ import puppeteer from "puppeteer";
12
+
13
+ // src/server/runtimes/web/esbuild.ts
14
+ var absoluteBundlesDir = (c) => {
15
+ return "./testeranto/bundles/allTests/web/";
16
+ };
17
+ var esbuild_default = (config, testName2) => {
18
+ const entrypoints = ["./example/Calculator.test.ts"];
19
+ const { inputFilesPluginFactory, register } = inputFilesPlugin_default(
20
+ "web",
21
+ testName2
22
+ );
23
+ return {
24
+ ...esbuildConfigs_default(config),
25
+ outdir: absoluteBundlesDir(config),
26
+ outbase: ".",
27
+ metafile: true,
28
+ supported: {
29
+ "dynamic-import": true
30
+ },
31
+ define: {
32
+ "process.env.FLUENTFFMPEG_COV": "0",
33
+ ENV: `"web"`
34
+ },
35
+ absWorkingDir: process.cwd(),
36
+ platform: "browser",
37
+ packages: "external",
38
+ entryPoints: entrypoints,
39
+ bundle: true,
40
+ format: "esm",
41
+ plugins: [
42
+ featuresPlugin_default,
43
+ inputFilesPluginFactory,
44
+ rebuildPlugin_default("web"),
45
+ ...config.web?.plugins?.map((p) => p(register, entrypoints)) || []
46
+ ]
47
+ };
48
+ };
49
+
50
+ // src/server/runtimes/web/web.ts
51
+ import * as fs from "fs";
52
+ import * as path from "path";
53
+ var configFilePath = process.argv[2];
54
+ var testName = process.argv[3] || "allTests";
55
+ async function startBundling(config) {
56
+ console.log(`[WEB BUILDER] is now bundling: ${testName}`);
57
+ if (!config) {
58
+ throw new Error("Config is undefined");
59
+ }
60
+ if (!config.buildDir) {
61
+ console.warn("config.buildDir is undefined, using default");
62
+ config.buildDir = "/workspace";
63
+ }
64
+ console.log(`Using build directory: ${config.buildDir}`);
65
+ const webConfig = esbuild_default(config, "allTests");
66
+ const buildResult = await esbuild.build(webConfig);
67
+ if (buildResult.metafile) {
68
+ await processMetafile(config, buildResult.metafile, "web");
69
+ const outputFiles = Object.keys(buildResult.metafile.outputs);
70
+ for (const outputFile of outputFiles) {
71
+ if (true) {
72
+ const htmlPath = `testeranto/bundles/allTests/web/example/Calculator.test.ts.html`;
73
+ await fs.promises.mkdir(path.dirname(htmlPath), { recursive: true });
74
+ const htmlContent = `<!DOCTYPE html>
75
+ <html>
76
+ <head>
77
+ <meta charset="UTF-8">
78
+ <title>Test Runner</title>
79
+ </head>
80
+ <body>
81
+ <div id="root"></div>
82
+ <script src="testeranto/bundles/allTests/web/example/Calculator.test.mjs"></script>
83
+ </body>
84
+ </html>`;
85
+ await fs.promises.writeFile(htmlPath, htmlContent);
86
+ console.log(`Created HTML file: ${htmlPath}`);
87
+ }
88
+ }
89
+ } else {
90
+ console.warn("No metafile generated by esbuild");
91
+ }
92
+ console.log("WEB BUILDER: Metafiles have been generated");
93
+ if (true) {
94
+ console.log(
95
+ "WEB BUILDER: Running in dev mode, keeping builder alive..."
96
+ );
97
+ const ctx = await esbuild.context(webConfig);
98
+ let { hosts, port } = await ctx.serve();
99
+ console.log(
100
+ `[WEB BUILDER]: esbuild server ${hosts}, ${port}`
101
+ );
102
+ process.on("SIGINT", async () => {
103
+ console.log("WEB BUILDER: Shutting down...");
104
+ process.exit(0);
105
+ });
106
+ try {
107
+ const browser = await puppeteer.launch({
108
+ // Flags required for Docker/Alpine compatibility
109
+ args: [
110
+ "--no-sandbox",
111
+ "--disable-setuid-sandbox",
112
+ "--disable-dev-shm-usage",
113
+ // Prevents crashes in low-memory Docker envs
114
+ "--disable-gpu",
115
+ "--single-process",
116
+ // Run in a single process
117
+ "--no-zygote",
118
+ // Disable zygote process
119
+ "--disable-background-timer-throttling",
120
+ // Disable throttling of timers in background pages
121
+ "--disable-backgrounding-occluded-windows",
122
+ // Disable backgrounding of occluded windows
123
+ "--disable-renderer-backgrounding",
124
+ // Disable backgrounding renders
125
+ "--remote-debugging-address=0.0.0.0",
126
+ // Allow remote debugging
127
+ "--remote-debugging-port=9222"
128
+ // Set remote debugging port
129
+ ],
130
+ // Automatically uses ENV PUPPETEER_EXECUTABLE_PATH
131
+ executablePath: process.env.PUPPETEER_EXECUTABLE_PATH || "/usr/bin/chromium-browser",
132
+ headless: true,
133
+ // Run in headless mode
134
+ timeout: 6e4
135
+ // Increase timeout to 60 seconds
136
+ });
137
+ console.log("Puppeteer launched successfully");
138
+ } catch (error) {
139
+ console.error("Failed to launch Puppeteer:", error);
140
+ process.exit(1);
141
+ }
142
+ await new Promise(() => {
143
+ });
144
+ }
145
+ }
146
+ async function main() {
147
+ try {
148
+ console.log(`[WEB BUILDER] Importing config from: ${configFilePath}`);
149
+ const imported = await import(configFilePath);
150
+ const config = imported.default;
151
+ if (!config) {
152
+ throw new Error(`Config not found in ${configFilePath}. Ensure the file exports a default object.`);
153
+ }
154
+ console.log("[WEB BUILDER] Config imported successfully:", Object.keys(config));
155
+ await startBundling(config);
156
+ console.log(`[WEB BUILDER] Puppeteer is running: ${puppeteer}`);
157
+ } catch (error) {
158
+ console.error(error);
159
+ process.exit(1);
160
+ }
161
+ }
162
+ main();