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.
- package/package.json +1 -1
- package/src/PM/main.ts +418 -92
- package/src/ReportClient.tsx +38 -30
- package/src/run.ts +4 -371
- package/tsc.log +8 -6
- package/dist/common/Init.js +0 -68
- package/dist/common/Node.js +0 -27
- package/dist/common/PM/index.js +0 -7
- package/dist/common/PM/main.js +0 -984
- package/dist/common/PM/node.js +0 -128
- package/dist/common/PM/web.js +0 -121
- package/dist/common/ReportServer.js +0 -22
- package/dist/common/SubPackages/react/component/node.js +0 -19
- package/dist/common/SubPackages/react/component/web.js +0 -19
- package/dist/common/SubPackages/react/jsx/index.js +0 -21
- package/dist/common/SubPackages/react/jsx/node.js +0 -10
- package/dist/common/SubPackages/react/jsx/web.js +0 -10
- package/dist/common/SubPackages/react-dom/component/node.js +0 -88
- package/dist/common/SubPackages/react-dom/component/web.js +0 -67
- package/dist/common/SubPackages/react-dom/jsx/index.js +0 -2
- package/dist/common/SubPackages/react-dom/jsx/node.js +0 -39
- package/dist/common/SubPackages/react-dom/jsx/web.js +0 -128
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -54
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -2
- package/dist/common/SubPackages/react-test-renderer/component/interface.js +0 -70
- package/dist/common/SubPackages/react-test-renderer/component/node.js +0 -8
- package/dist/common/SubPackages/react-test-renderer/component/web.js +0 -8
- package/dist/common/SubPackages/react-test-renderer/fc/node.js +0 -60
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +0 -60
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -67
- package/dist/common/SubPackages/react-test-renderer/jsx/node.js +0 -10
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +0 -10
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +0 -52
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
- package/dist/common/Types.js +0 -2
- package/dist/common/Web.js +0 -49
- package/dist/common/build.js +0 -222
- package/dist/common/defaultConfig.js +0 -20
- package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +0 -6
- package/dist/common/esbuildConfigs/featuresPlugin.js +0 -39
- package/dist/common/esbuildConfigs/index.js +0 -21
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +0 -27
- package/dist/common/esbuildConfigs/node.js +0 -37
- package/dist/common/esbuildConfigs/web.js +0 -50
- package/dist/common/init-docs.js +0 -53
- package/dist/common/lib/abstractBase.js +0 -329
- package/dist/common/lib/basebuilder.js +0 -98
- package/dist/common/lib/classBuilder.js +0 -40
- package/dist/common/lib/core.js +0 -117
- package/dist/common/lib/index.js +0 -21
- package/dist/common/lib/types.js +0 -2
- package/dist/common/package.json +0 -3
- package/dist/common/puppeteerConfiger.js +0 -24
- package/dist/common/run.js +0 -297
- package/dist/common/tsconfig.common.tsbuildinfo +0 -1
- package/dist/common/utils.js +0 -43
- package/dist/common/web.html.js +0 -22
- package/dist/module/Footer.js +0 -4
- package/dist/module/Init.js +0 -63
- package/dist/module/Node.js +0 -20
- package/dist/module/PM/index.js +0 -3
- package/dist/module/PM/main.js +0 -944
- package/dist/module/PM/node.js +0 -121
- package/dist/module/PM/web.js +0 -117
- package/dist/module/ReportClient.js +0 -97
- package/dist/module/ReportServer.js +0 -17
- package/dist/module/SubPackages/react/component/node.js +0 -14
- package/dist/module/SubPackages/react/component/web.js +0 -14
- package/dist/module/SubPackages/react/jsx/index.js +0 -15
- package/dist/module/SubPackages/react/jsx/node.js +0 -5
- package/dist/module/SubPackages/react/jsx/web.js +0 -5
- package/dist/module/SubPackages/react-dom/component/node.js +0 -80
- package/dist/module/SubPackages/react-dom/component/web.js +0 -62
- package/dist/module/SubPackages/react-dom/jsx/index.js +0 -1
- package/dist/module/SubPackages/react-dom/jsx/node.js +0 -31
- package/dist/module/SubPackages/react-dom/jsx/web.js +0 -90
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
- package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/SubPackages/react-test-renderer/component/interface.js +0 -31
- package/dist/module/SubPackages/react-test-renderer/component/node.js +0 -3
- package/dist/module/SubPackages/react-test-renderer/component/web.js +0 -3
- package/dist/module/SubPackages/react-test-renderer/fc/node.js +0 -22
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +0 -22
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -28
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +0 -5
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +0 -5
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
- package/dist/module/TestReport.js +0 -91
- package/dist/module/Types.js +0 -1
- package/dist/module/Web.js +0 -42
- package/dist/module/build.js +0 -184
- package/dist/module/defaultConfig.js +0 -18
- package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +0 -3
- package/dist/module/esbuildConfigs/featuresPlugin.js +0 -34
- package/dist/module/esbuildConfigs/index.js +0 -19
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +0 -22
- package/dist/module/esbuildConfigs/node.js +0 -32
- package/dist/module/esbuildConfigs/web.js +0 -45
- package/dist/module/init-docs.js +0 -15
- package/dist/module/lib/abstractBase.js +0 -321
- package/dist/module/lib/basebuilder.js +0 -94
- package/dist/module/lib/classBuilder.js +0 -36
- package/dist/module/lib/core.js +0 -114
- package/dist/module/lib/index.js +0 -17
- package/dist/module/lib/types.js +0 -1
- package/dist/module/package.json +0 -3
- package/dist/module/puppeteerConfiger.js +0 -19
- package/dist/module/run.js +0 -259
- package/dist/module/tsconfig.module.tsbuildinfo +0 -1
- package/dist/module/utils.js +0 -29
- package/dist/module/web.html.js +0 -20
- package/dist/prebuild/ReportClient.css +0 -11367
- package/dist/prebuild/ReportClient.js +0 -23641
- package/dist/prebuild/ReportServer.mjs +0 -16
- package/dist/prebuild/TestReport.css +0 -11367
- package/dist/prebuild/TestReport.js +0 -27484
- package/dist/prebuild/build.mjs +0 -376
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +0 -9
- package/dist/prebuild/init-docs.mjs +0 -104
- package/dist/prebuild/run.mjs +0 -1190
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/Init.d.ts +0 -2
- package/dist/types/Node.d.ts +0 -12
- package/dist/types/PM/index.d.ts +0 -34
- package/dist/types/PM/main.d.ts +0 -59
- package/dist/types/PM/node.d.ts +0 -40
- package/dist/types/PM/web.d.ts +0 -38
- package/dist/types/ReportServer.d.ts +0 -1
- package/dist/types/SubPackages/react/component/node.d.ts +0 -7
- package/dist/types/SubPackages/react/component/web.d.ts +0 -7
- package/dist/types/SubPackages/react/jsx/index.d.ts +0 -12
- package/dist/types/SubPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/SubPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/SubPackages/react-dom/component/node.d.ts +0 -11
- package/dist/types/SubPackages/react-dom/component/web.d.ts +0 -20
- package/dist/types/SubPackages/react-dom/jsx/index.d.ts +0 -6
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +0 -7
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -6
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +0 -13
- package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +0 -4
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +0 -4
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +0 -16
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -15
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -5
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -5
- package/dist/types/Types.d.ts +0 -61
- package/dist/types/Web.d.ts +0 -9
- package/dist/types/build.d.ts +0 -1
- package/dist/types/defaultConfig.d.ts +0 -3
- package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +0 -2
- package/dist/types/esbuildConfigs/featuresPlugin.d.ts +0 -5
- package/dist/types/esbuildConfigs/index.d.ts +0 -4
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +0 -6
- package/dist/types/esbuildConfigs/node.d.ts +0 -4
- package/dist/types/esbuildConfigs/web.d.ts +0 -4
- package/dist/types/init-docs.d.ts +0 -1
- package/dist/types/lib/abstractBase.d.ts +0 -110
- package/dist/types/lib/basebuilder.d.ts +0 -27
- package/dist/types/lib/classBuilder.d.ts +0 -7
- package/dist/types/lib/core.d.ts +0 -7
- package/dist/types/lib/index.d.ts +0 -83
- package/dist/types/lib/types.d.ts +0 -14
- package/dist/types/puppeteerConfiger.d.ts +0 -4
- package/dist/types/run.d.ts +0 -1
- package/dist/types/tsconfig.types.tsbuildinfo +0 -1
- package/dist/types/utils.d.ts +0 -9
- package/dist/types/web.html.d.ts +0 -2
package/dist/module/lib/core.js
DELETED
|
@@ -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
|
-
}
|
package/dist/module/lib/index.js
DELETED
|
@@ -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
|
-
};
|
package/dist/module/lib/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/module/package.json
DELETED
|
@@ -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
|
-
});
|
package/dist/module/run.js
DELETED
|
@@ -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
|
-
});
|