testeranto 0.110.0 → 0.111.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.
Files changed (176) hide show
  1. package/package.json +1 -1
  2. package/src/PM/main.ts +418 -92
  3. package/src/ReportClient.tsx +38 -30
  4. package/src/run.ts +4 -371
  5. package/tsc.log +8 -6
  6. package/dist/common/Init.js +0 -68
  7. package/dist/common/Node.js +0 -27
  8. package/dist/common/PM/index.js +0 -7
  9. package/dist/common/PM/main.js +0 -984
  10. package/dist/common/PM/node.js +0 -128
  11. package/dist/common/PM/web.js +0 -121
  12. package/dist/common/ReportServer.js +0 -22
  13. package/dist/common/SubPackages/react/component/node.js +0 -19
  14. package/dist/common/SubPackages/react/component/web.js +0 -19
  15. package/dist/common/SubPackages/react/jsx/index.js +0 -21
  16. package/dist/common/SubPackages/react/jsx/node.js +0 -10
  17. package/dist/common/SubPackages/react/jsx/web.js +0 -10
  18. package/dist/common/SubPackages/react-dom/component/node.js +0 -88
  19. package/dist/common/SubPackages/react-dom/component/web.js +0 -67
  20. package/dist/common/SubPackages/react-dom/jsx/index.js +0 -2
  21. package/dist/common/SubPackages/react-dom/jsx/node.js +0 -39
  22. package/dist/common/SubPackages/react-dom/jsx/web.js +0 -128
  23. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -54
  24. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -2
  25. package/dist/common/SubPackages/react-test-renderer/component/interface.js +0 -70
  26. package/dist/common/SubPackages/react-test-renderer/component/node.js +0 -8
  27. package/dist/common/SubPackages/react-test-renderer/component/web.js +0 -8
  28. package/dist/common/SubPackages/react-test-renderer/fc/node.js +0 -60
  29. package/dist/common/SubPackages/react-test-renderer/fc/web.js +0 -60
  30. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -67
  31. package/dist/common/SubPackages/react-test-renderer/jsx/node.js +0 -10
  32. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +0 -10
  33. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +0 -52
  34. package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
  35. package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
  36. package/dist/common/Types.js +0 -2
  37. package/dist/common/Web.js +0 -49
  38. package/dist/common/build.js +0 -222
  39. package/dist/common/defaultConfig.js +0 -20
  40. package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +0 -6
  41. package/dist/common/esbuildConfigs/featuresPlugin.js +0 -39
  42. package/dist/common/esbuildConfigs/index.js +0 -21
  43. package/dist/common/esbuildConfigs/inputFilesPlugin.js +0 -27
  44. package/dist/common/esbuildConfigs/node.js +0 -37
  45. package/dist/common/esbuildConfigs/web.js +0 -50
  46. package/dist/common/init-docs.js +0 -53
  47. package/dist/common/lib/abstractBase.js +0 -329
  48. package/dist/common/lib/basebuilder.js +0 -98
  49. package/dist/common/lib/classBuilder.js +0 -40
  50. package/dist/common/lib/core.js +0 -117
  51. package/dist/common/lib/index.js +0 -21
  52. package/dist/common/lib/types.js +0 -2
  53. package/dist/common/package.json +0 -3
  54. package/dist/common/puppeteerConfiger.js +0 -24
  55. package/dist/common/run.js +0 -297
  56. package/dist/common/tsconfig.common.tsbuildinfo +0 -1
  57. package/dist/common/utils.js +0 -43
  58. package/dist/common/web.html.js +0 -22
  59. package/dist/module/Footer.js +0 -4
  60. package/dist/module/Init.js +0 -63
  61. package/dist/module/Node.js +0 -20
  62. package/dist/module/PM/index.js +0 -3
  63. package/dist/module/PM/main.js +0 -944
  64. package/dist/module/PM/node.js +0 -121
  65. package/dist/module/PM/web.js +0 -117
  66. package/dist/module/ReportClient.js +0 -97
  67. package/dist/module/ReportServer.js +0 -17
  68. package/dist/module/SubPackages/react/component/node.js +0 -14
  69. package/dist/module/SubPackages/react/component/web.js +0 -14
  70. package/dist/module/SubPackages/react/jsx/index.js +0 -15
  71. package/dist/module/SubPackages/react/jsx/node.js +0 -5
  72. package/dist/module/SubPackages/react/jsx/web.js +0 -5
  73. package/dist/module/SubPackages/react-dom/component/node.js +0 -80
  74. package/dist/module/SubPackages/react-dom/component/web.js +0 -62
  75. package/dist/module/SubPackages/react-dom/jsx/index.js +0 -1
  76. package/dist/module/SubPackages/react-dom/jsx/node.js +0 -31
  77. package/dist/module/SubPackages/react-dom/jsx/web.js +0 -90
  78. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
  79. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  80. package/dist/module/SubPackages/react-test-renderer/component/interface.js +0 -31
  81. package/dist/module/SubPackages/react-test-renderer/component/node.js +0 -3
  82. package/dist/module/SubPackages/react-test-renderer/component/web.js +0 -3
  83. package/dist/module/SubPackages/react-test-renderer/fc/node.js +0 -22
  84. package/dist/module/SubPackages/react-test-renderer/fc/web.js +0 -22
  85. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -28
  86. package/dist/module/SubPackages/react-test-renderer/jsx/node.js +0 -5
  87. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +0 -5
  88. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
  89. package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
  90. package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
  91. package/dist/module/TestReport.js +0 -91
  92. package/dist/module/Types.js +0 -1
  93. package/dist/module/Web.js +0 -42
  94. package/dist/module/build.js +0 -184
  95. package/dist/module/defaultConfig.js +0 -18
  96. package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +0 -3
  97. package/dist/module/esbuildConfigs/featuresPlugin.js +0 -34
  98. package/dist/module/esbuildConfigs/index.js +0 -19
  99. package/dist/module/esbuildConfigs/inputFilesPlugin.js +0 -22
  100. package/dist/module/esbuildConfigs/node.js +0 -32
  101. package/dist/module/esbuildConfigs/web.js +0 -45
  102. package/dist/module/init-docs.js +0 -15
  103. package/dist/module/lib/abstractBase.js +0 -321
  104. package/dist/module/lib/basebuilder.js +0 -94
  105. package/dist/module/lib/classBuilder.js +0 -36
  106. package/dist/module/lib/core.js +0 -114
  107. package/dist/module/lib/index.js +0 -17
  108. package/dist/module/lib/types.js +0 -1
  109. package/dist/module/package.json +0 -3
  110. package/dist/module/puppeteerConfiger.js +0 -19
  111. package/dist/module/run.js +0 -259
  112. package/dist/module/tsconfig.module.tsbuildinfo +0 -1
  113. package/dist/module/utils.js +0 -29
  114. package/dist/module/web.html.js +0 -20
  115. package/dist/prebuild/ReportClient.css +0 -11367
  116. package/dist/prebuild/ReportClient.js +0 -23641
  117. package/dist/prebuild/ReportServer.mjs +0 -16
  118. package/dist/prebuild/TestReport.css +0 -11367
  119. package/dist/prebuild/TestReport.js +0 -27484
  120. package/dist/prebuild/build.mjs +0 -376
  121. package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +0 -9
  122. package/dist/prebuild/init-docs.mjs +0 -104
  123. package/dist/prebuild/run.mjs +0 -1190
  124. package/dist/tsconfig.tsbuildinfo +0 -1
  125. package/dist/types/Init.d.ts +0 -2
  126. package/dist/types/Node.d.ts +0 -12
  127. package/dist/types/PM/index.d.ts +0 -34
  128. package/dist/types/PM/main.d.ts +0 -59
  129. package/dist/types/PM/node.d.ts +0 -40
  130. package/dist/types/PM/web.d.ts +0 -38
  131. package/dist/types/ReportServer.d.ts +0 -1
  132. package/dist/types/SubPackages/react/component/node.d.ts +0 -7
  133. package/dist/types/SubPackages/react/component/web.d.ts +0 -7
  134. package/dist/types/SubPackages/react/jsx/index.d.ts +0 -12
  135. package/dist/types/SubPackages/react/jsx/node.d.ts +0 -4
  136. package/dist/types/SubPackages/react/jsx/web.d.ts +0 -4
  137. package/dist/types/SubPackages/react-dom/component/node.d.ts +0 -11
  138. package/dist/types/SubPackages/react-dom/component/web.d.ts +0 -20
  139. package/dist/types/SubPackages/react-dom/jsx/index.d.ts +0 -6
  140. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +0 -7
  141. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +0 -5
  142. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -6
  143. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +0 -13
  144. package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
  145. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +0 -4
  146. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +0 -4
  147. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
  148. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +0 -9
  149. package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +0 -16
  150. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
  151. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +0 -9
  152. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -15
  153. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -5
  154. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -5
  155. package/dist/types/Types.d.ts +0 -61
  156. package/dist/types/Web.d.ts +0 -9
  157. package/dist/types/build.d.ts +0 -1
  158. package/dist/types/defaultConfig.d.ts +0 -3
  159. package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +0 -2
  160. package/dist/types/esbuildConfigs/featuresPlugin.d.ts +0 -5
  161. package/dist/types/esbuildConfigs/index.d.ts +0 -4
  162. package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +0 -6
  163. package/dist/types/esbuildConfigs/node.d.ts +0 -4
  164. package/dist/types/esbuildConfigs/web.d.ts +0 -4
  165. package/dist/types/init-docs.d.ts +0 -1
  166. package/dist/types/lib/abstractBase.d.ts +0 -110
  167. package/dist/types/lib/basebuilder.d.ts +0 -27
  168. package/dist/types/lib/classBuilder.d.ts +0 -7
  169. package/dist/types/lib/core.d.ts +0 -7
  170. package/dist/types/lib/index.d.ts +0 -83
  171. package/dist/types/lib/types.d.ts +0 -14
  172. package/dist/types/puppeteerConfiger.d.ts +0 -4
  173. package/dist/types/run.d.ts +0 -1
  174. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  175. package/dist/types/utils.d.ts +0 -9
  176. package/dist/types/web.html.d.ts +0 -2
@@ -1,114 +0,0 @@
1
- import { DefaultTestInterface, defaultTestResourceRequirement, } from "./index.js";
2
- import { BaseSuite, BaseGiven, BaseWhen, BaseThen, BaseCheck, } from "./abstractBase.js";
3
- import { ClassBuilder } from "./classBuilder.js";
4
- export default class Testeranto extends ClassBuilder {
5
- constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testInterface, uberCatcher) {
6
- const fullTestInterface = DefaultTestInterface(testInterface);
7
- super(testImplementation, testSpecification, input, class extends BaseSuite {
8
- afterAll(store, artifactory, pm) {
9
- return fullTestInterface.afterAll(store,
10
- // (fPath: string, value: unknown) =>
11
- // // TODO does not work?
12
- // {
13
- // artifactory(`afterAll4-${this.name}/${fPath}`, value);
14
- // },
15
- pm);
16
- }
17
- assertThat(t) {
18
- fullTestInterface.assertThis(t);
19
- }
20
- async setup(s, artifactory, tr, pm) {
21
- return (fullTestInterface.beforeAll ||
22
- (async (input, artifactory, tr, pm) => input))(s, this.testResourceConfiguration,
23
- // artifactory,
24
- pm);
25
- }
26
- }, class Given extends BaseGiven {
27
- constructor() {
28
- super(...arguments);
29
- this.uberCatcher = uberCatcher;
30
- }
31
- async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
32
- return fullTestInterface.beforeEach(subject, initializer,
33
- // artifactory,
34
- testResource, initialValues, pm);
35
- }
36
- afterEach(store, key, artifactory, pm) {
37
- return new Promise((res) => res(fullTestInterface.afterEach(store, key,
38
- // (fPath: string, value: unknown) =>
39
- // artifactory(`after/${fPath}`, value),
40
- pm)));
41
- }
42
- }, class When extends BaseWhen {
43
- async andWhen(store, whenCB, testResource, pm) {
44
- try {
45
- return await fullTestInterface.andWhen(store, whenCB, testResource, pm);
46
- }
47
- catch (e) {
48
- throw e;
49
- }
50
- // return fullTestInterface
51
- // .andWhen(store, whenCB, testResource, pm)
52
- // .catch((e) => {
53
- // throw e;
54
- // });
55
- // return new Promise((res, rej) => {
56
- // fullTestInterface.andWhen(store, whenCB, testResource, pm);
57
- // });
58
- // return await fullTestInterface.andWhen(
59
- // store,
60
- // whenCB,
61
- // testResource,
62
- // pm
63
- // );
64
- }
65
- }, class Then extends BaseThen {
66
- async butThen(store, thenCB, testResource, pm) {
67
- return await fullTestInterface
68
- .butThen(store, thenCB, testResource, pm)
69
- .then((v) => {
70
- return v;
71
- }, (e) => {
72
- console.log(" ERROR ", e);
73
- throw e;
74
- });
75
- // try {
76
- // console.log("mark 4");
77
- // return await fullTestInterface.butThen(
78
- // store,
79
- // thenCB,
80
- // testResource,
81
- // pm
82
- // );
83
- // } catch (e) {
84
- // console.log("mar123");
85
- // throw e;
86
- // }
87
- // return await fullTestInterface.butThen(
88
- // store,
89
- // thenCB,
90
- // testResourceConfiguration,
91
- // pm
92
- // );
93
- }
94
- }, class Check extends BaseCheck {
95
- constructor(name, features, checkCallback, whens, thens, initialValues) {
96
- super(name, features, checkCallback, whens, thens);
97
- this.initialValues = initialValues;
98
- }
99
- async checkThat(subject, testResourceConfiguration, artifactory, pm) {
100
- return fullTestInterface.beforeEach(subject, this.initialValues,
101
- // (fPath: string, value: unknown) =>
102
- // artifactory(`before/${fPath}`, value),
103
- testResourceConfiguration, this.initialValues, pm);
104
- }
105
- afterEach(store, key, artifactory, pm) {
106
- return new Promise((res) => res(fullTestInterface.afterEach(store, key,
107
- // (fPath: string, value: unknown) =>
108
- // // TODO does not work?
109
- // artifactory(`afterEach2-${this.name}/${fPath}`, value),
110
- pm)));
111
- }
112
- }, testResourceRequirement);
113
- }
114
- }
@@ -1,17 +0,0 @@
1
- export const BaseTestInterface = {
2
- beforeAll: async (s) => s,
3
- beforeEach: async function (subject, initialValues, x, testResource, pm) {
4
- return subject;
5
- },
6
- afterEach: async (s) => s,
7
- afterAll: (store) => undefined,
8
- butThen: async (store, thenCb) => thenCb(store),
9
- andWhen: (a) => a,
10
- assertThis: () => null,
11
- };
12
- export const DefaultTestInterface = (p) => {
13
- return Object.assign(Object.assign({}, BaseTestInterface), p);
14
- };
15
- export const defaultTestResourceRequirement = {
16
- ports: 0,
17
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,19 +0,0 @@
1
- import http from "http";
2
- export default async (port) => new Promise((resolve, reject) => {
3
- let json = "";
4
- const request = http.request({
5
- host: "127.0.0.1",
6
- path: "/json/version",
7
- port,
8
- }, (response) => {
9
- response.on("error", reject);
10
- response.on("data", (chunk) => {
11
- json += chunk.toString();
12
- });
13
- response.on("end", () => {
14
- resolve(JSON.parse(json));
15
- });
16
- });
17
- request.on("error", reject);
18
- request.end();
19
- });
@@ -1,259 +0,0 @@
1
- import ansiC from "ansi-colors";
2
- import { watch } from "fs";
3
- import path from "path";
4
- import crypto from "node:crypto";
5
- import fs from "fs";
6
- import tsc from "tsc-prog";
7
- import { ESLint } from "eslint";
8
- import ts from "typescript";
9
- import readline from "readline";
10
- import { PM_Main } from "./PM/main";
11
- import { lintExitCodePather, lintPather, tscExitCodePather, tscPather, } from "./utils";
12
- console.log(ansiC.inverse("Press 'x' to shutdown forcefully."));
13
- readline.emitKeypressEvents(process.stdin);
14
- if (process.stdin.isTTY)
15
- process.stdin.setRawMode(true);
16
- process.stdin.on("keypress", (str, key) => {
17
- if (key.name === "x") {
18
- console.log(ansiC.inverse("Shutting down forcefully..."));
19
- process.exit(-1);
20
- }
21
- });
22
- async function fileHash(filePath, algorithm = "md5") {
23
- return new Promise((resolve, reject) => {
24
- const hash = crypto.createHash(algorithm);
25
- const fileStream = fs.createReadStream(filePath);
26
- fileStream.on("data", (data) => {
27
- hash.update(data);
28
- });
29
- fileStream.on("end", () => {
30
- const fileHash = hash.digest("hex");
31
- resolve(fileHash);
32
- });
33
- fileStream.on("error", (error) => {
34
- reject(`Error reading file: ${error.message}`);
35
- });
36
- });
37
- }
38
- async function filesHash(files, algorithm = "md5") {
39
- return new Promise((resolve, reject) => {
40
- resolve(files.reduce(async (mm, f) => {
41
- return (await mm) + (await fileHash(f));
42
- }, Promise.resolve("")));
43
- });
44
- }
45
- const getRunnables = (tests, payload = {
46
- nodeEntryPoints: {},
47
- webEntryPoints: {},
48
- }) => {
49
- return tests.reduce((pt, cv, cndx, cry) => {
50
- if (cv[1] === "node") {
51
- pt.nodeEntryPoints[cv[0]] = path.resolve(`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
52
- }
53
- else if (cv[1] === "web") {
54
- pt.webEntryPoints[cv[0]] = path.resolve(`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
55
- }
56
- if (cv[3].length) {
57
- getRunnables(cv[3], payload);
58
- }
59
- return pt;
60
- }, payload);
61
- };
62
- const changes = {};
63
- const tscCheck = async ({ entrypoint, addableFiles, platform, }) => {
64
- console.log(ansiC.green(ansiC.inverse(`tsc < ${entrypoint}`)));
65
- const program = tsc.createProgramFromConfig({
66
- basePath: process.cwd(), // always required, used for relative paths
67
- configFilePath: "tsconfig.json", // config to inherit from (optional)
68
- compilerOptions: {
69
- rootDir: "src",
70
- outDir: tscPather(entrypoint, platform),
71
- // declaration: true,
72
- // skipLibCheck: true,
73
- noEmit: true,
74
- },
75
- include: addableFiles, //["src/**/*"],
76
- // exclude: ["**/*.test.ts", "**/*.spec.ts"],
77
- });
78
- const tscPath = tscPather(entrypoint, platform);
79
- let allDiagnostics = program.getSemanticDiagnostics();
80
- const d = [];
81
- allDiagnostics.forEach((diagnostic) => {
82
- if (diagnostic.file) {
83
- let { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
84
- let message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
85
- d.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
86
- }
87
- else {
88
- d.push(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
89
- }
90
- });
91
- fs.writeFileSync(tscPath, d.join("\n"));
92
- fs.writeFileSync(tscExitCodePather(entrypoint, platform), d.length.toString());
93
- };
94
- const eslint = new ESLint();
95
- const formatter = await eslint.loadFormatter("./node_modules/testeranto/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs");
96
- const eslintCheck = async (entrypoint, platform, addableFiles) => {
97
- console.log(ansiC.green(ansiC.inverse(`eslint < ${entrypoint}`)));
98
- const results = (await eslint.lintFiles(addableFiles))
99
- .filter((r) => r.messages.length)
100
- .filter((r) => {
101
- return r.messages[0].ruleId !== null;
102
- })
103
- .map((r) => {
104
- delete r.source;
105
- return r;
106
- });
107
- fs.writeFileSync(lintPather(entrypoint, platform), await formatter.format(results));
108
- fs.writeFileSync(lintExitCodePather(entrypoint, platform), results.length.toString());
109
- };
110
- const makePrompt = async (entryPoint, addableFiles, platform) => {
111
- const promptPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
112
- const testPaths = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
113
- const featuresPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
114
- fs.writeFileSync(promptPath, `
115
- ${addableFiles
116
- .map((x) => {
117
- return `/add ${x}`;
118
- })
119
- .join("\n")}
120
-
121
- /read ${lintPather(entryPoint, platform)}
122
- /read ${tscPather(entryPoint, platform)}
123
- /read ${testPaths}
124
-
125
- /load ${featuresPath}
126
-
127
- /code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${tscPather(entryPoint, platform)}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPather(entryPoint, platform)}"
128
- `);
129
- };
130
- const metafileOutputs = async (platform) => {
131
- const metafile = JSON.parse(fs.readFileSync(`docs/${platform}/metafile.json`).toString()).metafile;
132
- if (!metafile)
133
- return;
134
- const outputs = metafile.outputs;
135
- Object.keys(outputs).forEach(async (k) => {
136
- const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
137
- if (!fs.existsSync(i))
138
- return false;
139
- if (i.startsWith("node_modules"))
140
- return false;
141
- return true;
142
- });
143
- const f = `${k.split(".").slice(0, -1).join(".")}/`;
144
- if (!fs.existsSync(f)) {
145
- fs.mkdirSync(f);
146
- }
147
- const entrypoint = outputs[k].entryPoint;
148
- if (entrypoint) {
149
- const changeDigest = await filesHash(addableFiles);
150
- if (changeDigest === changes[entrypoint]) {
151
- // skip
152
- }
153
- else {
154
- changes[entrypoint] = changeDigest;
155
- tscCheck({ platform, addableFiles, entrypoint });
156
- eslintCheck(entrypoint, platform, addableFiles);
157
- makePrompt(entrypoint, addableFiles, platform);
158
- }
159
- }
160
- });
161
- };
162
- import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
163
- const rawConfig = module.default;
164
- const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/" + rawConfig.outdir });
165
- let mode = config.devMode ? "DEV" : "PROD";
166
- const fileHashes = {};
167
- let pm = new PM_Main(config);
168
- console.log(ansiC.inverse(`Press 'q' to shutdown gracefully`));
169
- process.stdin.on("keypress", (str, key) => {
170
- if (key.name === "q") {
171
- console.log(ansiC.inverse("Testeranto-Run is shutting down gracefully..."));
172
- mode = "PROD";
173
- // onDone();
174
- nodeMetafileWatcher.close();
175
- webMetafileWatcher.close();
176
- pm.shutDown();
177
- }
178
- });
179
- metafileOutputs("node");
180
- const nodeMetafileWatcher = watch("docs/node/metafile.json", async (e, filename) => {
181
- console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename} (node)`)));
182
- metafileOutputs("node");
183
- });
184
- metafileOutputs("web");
185
- const webMetafileWatcher = watch("docs/web/metafile.json", async (e, filename) => {
186
- console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename} (web)`)));
187
- metafileOutputs("web");
188
- });
189
- await pm.startPuppeteer({
190
- slowMo: 1,
191
- // timeout: 1,
192
- waitForInitialPage: false,
193
- executablePath:
194
- // process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
195
- "/opt/homebrew/bin/chromium",
196
- headless: true,
197
- dumpio: true,
198
- // timeout: 0,
199
- devtools: true,
200
- args: [
201
- "--auto-open-devtools-for-tabs",
202
- `--remote-debugging-port=3234`,
203
- // "--disable-features=IsolateOrigins,site-per-process",
204
- "--disable-site-isolation-trials",
205
- "--allow-insecure-localhost",
206
- "--allow-file-access-from-files",
207
- "--allow-running-insecure-content",
208
- "--disable-dev-shm-usage",
209
- "--disable-extensions",
210
- "--disable-gpu",
211
- "--disable-setuid-sandbox",
212
- "--disable-site-isolation-trials",
213
- "--disable-web-security",
214
- "--no-first-run",
215
- "--no-sandbox",
216
- "--no-startup-window",
217
- // "--no-zygote",
218
- "--reduce-security-for-testing",
219
- "--remote-allow-origins=*",
220
- "--unsafely-treat-insecure-origin-as-secure=*",
221
- // "--disable-features=IsolateOrigins",
222
- // "--remote-allow-origins=ws://localhost:3234",
223
- // "--single-process",
224
- // "--unsafely-treat-insecure-origin-as-secure",
225
- // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
226
- // "--disk-cache-dir=/dev/null",
227
- // "--disk-cache-size=1",
228
- // "--start-maximized",
229
- ],
230
- }, ".");
231
- const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
232
- Object.entries(nodeEntryPoints).forEach(([k, outputFile]) => {
233
- pm.launchNode(k, outputFile);
234
- try {
235
- watch(outputFile, async (e, filename) => {
236
- const hash = await fileHash(outputFile);
237
- if (fileHashes[k] !== hash) {
238
- fileHashes[k] = hash;
239
- console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
240
- pm.launchNode(k, outputFile);
241
- }
242
- });
243
- }
244
- catch (e) {
245
- console.error(e);
246
- }
247
- });
248
- Object.entries(webEntryPoints).forEach(([k, outputFile]) => {
249
- pm.launchWeb(k, outputFile);
250
- watch(outputFile, async (e, filename) => {
251
- const hash = await fileHash(outputFile);
252
- if (fileHashes[k] !== hash) {
253
- fileHashes[k] = hash;
254
- console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
255
- pm.launchWeb(k, outputFile);
256
- }
257
- });
258
- });
259
- });