testeranto 0.110.0 → 0.112.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/dist/common/PM/main.js +279 -87
- package/dist/common/run.js +4 -239
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/PM/main.js +280 -88
- package/dist/module/ReportClient.js +46 -46
- package/dist/module/run.js +4 -239
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/ReportClient.js +1060 -60
- package/dist/prebuild/run.mjs +297 -334
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/PM/main.d.ts +16 -9
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/utils.d.ts +6 -0
- package/package.json +1 -1
- package/src/PM/main.ts +406 -112
- package/src/ReportClient.tsx +80 -70
- package/src/run.ts +5 -369
- package/src/utils.ts +10 -0
- package/tsc.log +8 -6
package/src/ReportClient.tsx
CHANGED
|
@@ -6,6 +6,8 @@ import "./style.css"
|
|
|
6
6
|
|
|
7
7
|
import { IRunTime, ITestTypes, IBuiltConfig } from "./lib";
|
|
8
8
|
import { Footer } from "./Footer";
|
|
9
|
+
import { Table } from "react-bootstrap";
|
|
10
|
+
import { ISummary } from "./utils";
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
type ICollation = {
|
|
@@ -15,10 +17,10 @@ type ICollation = {
|
|
|
15
17
|
ports: number;
|
|
16
18
|
};
|
|
17
19
|
sidecars: ITestTypes[];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
staticAnalysis: number | "?";
|
|
21
|
+
typeErrors: number | "?";
|
|
22
|
+
bddErrors: number | "?";
|
|
23
|
+
prompt: string | "?";
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
type ICollations = ICollation[];
|
|
@@ -38,10 +40,10 @@ const BigBoard = () => {
|
|
|
38
40
|
})();
|
|
39
41
|
}, []);
|
|
40
42
|
|
|
41
|
-
const [bigBoard, setBigBoard] = useState<Record<string,
|
|
43
|
+
const [bigBoard, setBigBoard] = useState<Record<string, ISummary>>({});
|
|
42
44
|
useEffect(() => {
|
|
43
45
|
(async () => {
|
|
44
|
-
fetch('/kokomoBay/docs/
|
|
46
|
+
fetch('/kokomoBay/docs/summary.json')
|
|
45
47
|
.then(response => response.json())
|
|
46
48
|
.then(json => {
|
|
47
49
|
setBigBoard(json)
|
|
@@ -51,49 +53,49 @@ const BigBoard = () => {
|
|
|
51
53
|
})();
|
|
52
54
|
}, []);
|
|
53
55
|
|
|
54
|
-
const [staticAnalysis, setStaticAnalysis] = useState<Record<string, string>>({});
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
|
|
56
|
+
// const [staticAnalysis, setStaticAnalysis] = useState<Record<string, string>>({});
|
|
57
|
+
// useEffect(() => {
|
|
58
|
+
// (async () => {
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
// let accumulator = {};
|
|
61
|
+
// for (const t of (configs || { tests: [] as ITestTypes[] }).tests) {
|
|
62
|
+
// accumulator[t[0]] = await (await fetch(`/kokomoBay/docs/${t[1]}/${t[0].split(".").slice(0, -1).join(".")}/lint_errors.txt`)).text()
|
|
63
|
+
// }
|
|
64
|
+
// setStaticAnalysis(accumulator);
|
|
63
65
|
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
}, [configs, bigBoard]);
|
|
67
|
+
// })();
|
|
68
|
+
// }, [configs, bigBoard]);
|
|
67
69
|
|
|
68
|
-
const [typeErrors, setTypeErrors] = useState<Record<string, string>>({});
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
|
|
70
|
+
// const [typeErrors, setTypeErrors] = useState<Record<string, string>>({});
|
|
71
|
+
// useEffect(() => {
|
|
72
|
+
// (async () => {
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
// let accumulator = {};
|
|
75
|
+
// for (const t of (configs || { tests: [] as ITestTypes[] }).tests) {
|
|
76
|
+
// accumulator[t[0]] = await (await fetch(`/kokomoBay/docs/${t[1]}/${t[0].split(".").slice(0, -1).join(".")}/type_errors.txt`)).text()
|
|
77
|
+
// }
|
|
78
|
+
// setTypeErrors(accumulator);
|
|
77
79
|
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
}, [configs, bigBoard]);
|
|
81
|
+
// })();
|
|
82
|
+
// }, [configs, bigBoard]);
|
|
81
83
|
|
|
82
|
-
const [bddErrors, setBddErrors] = useState<Record<string, string>>({});
|
|
83
|
-
useEffect(() => {
|
|
84
|
-
|
|
84
|
+
// const [bddErrors, setBddErrors] = useState<Record<string, string>>({});
|
|
85
|
+
// useEffect(() => {
|
|
86
|
+
// (async () => {
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
// let accumulator = {};
|
|
89
|
+
// for (const t of (configs || { tests: [] as ITestTypes[] }).tests) {
|
|
90
|
+
// accumulator[t[0]] = await (await fetch(`/kokomoBay/docs/${t[1]}/${t[0].split(".").slice(0, -1).join(".")}/bdd_errors.txt`)).text()
|
|
91
|
+
// }
|
|
92
|
+
// setBddErrors(accumulator);
|
|
91
93
|
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
}, [configs, bigBoard]);
|
|
95
|
+
// })();
|
|
96
|
+
// }, [configs, bigBoard]);
|
|
95
97
|
|
|
96
|
-
if (!configs
|
|
98
|
+
if (!configs) {
|
|
97
99
|
return <div>loading...</div>
|
|
98
100
|
}
|
|
99
101
|
|
|
@@ -104,43 +106,51 @@ const BigBoard = () => {
|
|
|
104
106
|
runTime: c[1],
|
|
105
107
|
tr: c[2],
|
|
106
108
|
sidecars: c[3],
|
|
107
|
-
staticAnalysis:
|
|
108
|
-
typeErrors:
|
|
109
|
-
bddErrors:
|
|
109
|
+
staticAnalysis: bigBoard[c[0]].staticErrors,
|
|
110
|
+
typeErrors: bigBoard[c[0]].typeErrors,
|
|
111
|
+
bddErrors: bigBoard[c[0]].runTimeError,
|
|
112
|
+
prompt: bigBoard[c[0]].prompt
|
|
110
113
|
} as ICollation
|
|
111
114
|
});
|
|
112
115
|
|
|
113
116
|
return <div >
|
|
114
|
-
<
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
117
|
+
<Table striped bordered hover>
|
|
118
|
+
<thead>
|
|
119
|
+
<tr>
|
|
120
|
+
<th></th>
|
|
121
|
+
<th>platform</th>
|
|
122
|
+
<th>BDD errors</th>
|
|
123
|
+
<th>Lint errors</th>
|
|
124
|
+
<th>Type errors</th>
|
|
125
|
+
<th>prompt</th>
|
|
126
|
+
</tr>
|
|
127
|
+
|
|
128
|
+
</thead>
|
|
129
|
+
|
|
130
|
+
<tbody>
|
|
131
|
+
{
|
|
132
|
+
...collated.map((c) => {
|
|
133
|
+
return <tr>
|
|
134
|
+
<td>{c.name}</td>
|
|
135
|
+
<td>{c.runTime}</td>
|
|
136
|
+
<td><a href={`${c.runTime}/${c.name.split(".").slice(0, -1).join(".")}/littleBoard.html`}>{c.bddErrors}</a></td>
|
|
137
|
+
<td><a href={`${c.runTime}/${c.name.split(".").slice(0, -1).join(".")}/lint_errors.json`}>{c.staticAnalysis}</a></td>
|
|
138
|
+
<td><a href={`${c.runTime}/${c.name.split(".").slice(0, -1).join(".")}/type_errors.txt`}>{c.typeErrors}</a></td>
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<td>
|
|
142
|
+
<pre>
|
|
143
|
+
{c.prompt}
|
|
144
|
+
</pre>
|
|
145
|
+
</td>
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
</tr>
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
</tbody>
|
|
152
|
+
|
|
153
|
+
</Table>
|
|
144
154
|
<Footer />
|
|
145
155
|
</div>
|
|
146
156
|
}
|
package/src/run.ts
CHANGED
|
@@ -1,27 +1,13 @@
|
|
|
1
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
2
|
import readline from "readline";
|
|
10
3
|
|
|
11
4
|
import { PM_Main } from "./PM/main";
|
|
12
|
-
import {
|
|
13
|
-
lintExitCodePather,
|
|
14
|
-
lintPather,
|
|
15
|
-
tscExitCodePather,
|
|
16
|
-
tscPather,
|
|
17
|
-
} from "./utils";
|
|
18
|
-
import { IBaseConfig, IBuiltConfig, IRunnables, ITestTypes } from "./lib";
|
|
19
|
-
|
|
20
|
-
console.log(ansiC.inverse("Press 'x' to shutdown forcefully."));
|
|
5
|
+
import { IBaseConfig, IBuiltConfig } from "./lib";
|
|
21
6
|
|
|
22
7
|
readline.emitKeypressEvents(process.stdin);
|
|
23
8
|
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
24
9
|
|
|
10
|
+
console.log(ansiC.inverse("Press 'x' to shutdown forcefully."));
|
|
25
11
|
process.stdin.on("keypress", (str, key) => {
|
|
26
12
|
if (key.name === "x") {
|
|
27
13
|
console.log(ansiC.inverse("Shutting down forcefully..."));
|
|
@@ -29,245 +15,6 @@ process.stdin.on("keypress", (str, key) => {
|
|
|
29
15
|
}
|
|
30
16
|
});
|
|
31
17
|
|
|
32
|
-
async function fileHash(filePath, algorithm = "md5") {
|
|
33
|
-
return new Promise<string>((resolve, reject) => {
|
|
34
|
-
const hash = crypto.createHash(algorithm);
|
|
35
|
-
const fileStream = fs.createReadStream(filePath);
|
|
36
|
-
|
|
37
|
-
fileStream.on("data", (data) => {
|
|
38
|
-
hash.update(data);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
fileStream.on("end", () => {
|
|
42
|
-
const fileHash = hash.digest("hex");
|
|
43
|
-
resolve(fileHash);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
fileStream.on("error", (error) => {
|
|
47
|
-
reject(`Error reading file: ${error.message}`);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function filesHash(files: string[], algorithm = "md5") {
|
|
53
|
-
return new Promise<string>((resolve, reject) => {
|
|
54
|
-
resolve(
|
|
55
|
-
files.reduce(async (mm: Promise<string>, f) => {
|
|
56
|
-
return (await mm) + (await fileHash(f));
|
|
57
|
-
}, Promise.resolve(""))
|
|
58
|
-
);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
const getRunnables = (
|
|
62
|
-
tests: ITestTypes[],
|
|
63
|
-
payload = {
|
|
64
|
-
nodeEntryPoints: {},
|
|
65
|
-
webEntryPoints: {},
|
|
66
|
-
}
|
|
67
|
-
): IRunnables => {
|
|
68
|
-
return tests.reduce((pt, cv, cndx, cry) => {
|
|
69
|
-
if (cv[1] === "node") {
|
|
70
|
-
pt.nodeEntryPoints[cv[0]] = path.resolve(
|
|
71
|
-
`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
72
|
-
);
|
|
73
|
-
} else if (cv[1] === "web") {
|
|
74
|
-
pt.webEntryPoints[cv[0]] = path.resolve(
|
|
75
|
-
`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (cv[3].length) {
|
|
80
|
-
getRunnables(cv[3], payload);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return pt;
|
|
84
|
-
}, payload as IRunnables);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const changes: Record<string, string> = {};
|
|
88
|
-
|
|
89
|
-
const tscCheck = async ({
|
|
90
|
-
entrypoint,
|
|
91
|
-
addableFiles,
|
|
92
|
-
platform,
|
|
93
|
-
}: {
|
|
94
|
-
platform: "web" | "node";
|
|
95
|
-
entrypoint: string;
|
|
96
|
-
addableFiles: string[];
|
|
97
|
-
}) => {
|
|
98
|
-
console.log(ansiC.green(ansiC.inverse(`tsc < ${entrypoint}`)));
|
|
99
|
-
const program = tsc.createProgramFromConfig({
|
|
100
|
-
basePath: process.cwd(), // always required, used for relative paths
|
|
101
|
-
configFilePath: "tsconfig.json", // config to inherit from (optional)
|
|
102
|
-
compilerOptions: {
|
|
103
|
-
rootDir: "src",
|
|
104
|
-
outDir: tscPather(entrypoint, platform),
|
|
105
|
-
// declaration: true,
|
|
106
|
-
// skipLibCheck: true,
|
|
107
|
-
noEmit: true,
|
|
108
|
-
},
|
|
109
|
-
include: addableFiles, //["src/**/*"],
|
|
110
|
-
// exclude: ["**/*.test.ts", "**/*.spec.ts"],
|
|
111
|
-
});
|
|
112
|
-
const tscPath = tscPather(entrypoint, platform);
|
|
113
|
-
|
|
114
|
-
let allDiagnostics = program.getSemanticDiagnostics();
|
|
115
|
-
|
|
116
|
-
const d: string[] = [];
|
|
117
|
-
allDiagnostics.forEach((diagnostic) => {
|
|
118
|
-
if (diagnostic.file) {
|
|
119
|
-
let { line, character } = ts.getLineAndCharacterOfPosition(
|
|
120
|
-
diagnostic.file,
|
|
121
|
-
diagnostic.start!
|
|
122
|
-
);
|
|
123
|
-
let message = ts.flattenDiagnosticMessageText(
|
|
124
|
-
diagnostic.messageText,
|
|
125
|
-
"\n"
|
|
126
|
-
);
|
|
127
|
-
d.push(
|
|
128
|
-
`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
|
|
129
|
-
);
|
|
130
|
-
} else {
|
|
131
|
-
d.push(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
fs.writeFileSync(tscPath, d.join("\n"));
|
|
136
|
-
fs.writeFileSync(
|
|
137
|
-
tscExitCodePather(entrypoint, platform),
|
|
138
|
-
d.length.toString()
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const eslint = new ESLint();
|
|
143
|
-
const formatter = await eslint.loadFormatter(
|
|
144
|
-
"./node_modules/testeranto/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs"
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
const eslintCheck = async (
|
|
148
|
-
entrypoint: string,
|
|
149
|
-
platform: "web" | "node",
|
|
150
|
-
addableFiles: string[]
|
|
151
|
-
) => {
|
|
152
|
-
console.log(ansiC.green(ansiC.inverse(`eslint < ${entrypoint}`)));
|
|
153
|
-
const results = (await eslint.lintFiles(addableFiles))
|
|
154
|
-
.filter((r) => r.messages.length)
|
|
155
|
-
.filter((r) => {
|
|
156
|
-
return r.messages[0].ruleId !== null;
|
|
157
|
-
})
|
|
158
|
-
.map((r) => {
|
|
159
|
-
delete r.source;
|
|
160
|
-
return r;
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
fs.writeFileSync(
|
|
164
|
-
lintPather(entrypoint, platform),
|
|
165
|
-
await formatter.format(results)
|
|
166
|
-
);
|
|
167
|
-
fs.writeFileSync(
|
|
168
|
-
lintExitCodePather(entrypoint, platform),
|
|
169
|
-
results.length.toString()
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const makePrompt = async (
|
|
174
|
-
entryPoint: string,
|
|
175
|
-
addableFiles: string[],
|
|
176
|
-
platform: "web" | "node"
|
|
177
|
-
) => {
|
|
178
|
-
const promptPath = path.join(
|
|
179
|
-
"./docs/",
|
|
180
|
-
platform,
|
|
181
|
-
entryPoint.split(".").slice(0, -1).join("."),
|
|
182
|
-
`prompt.txt`
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
const testPaths = path.join(
|
|
186
|
-
"./docs/",
|
|
187
|
-
platform,
|
|
188
|
-
entryPoint.split(".").slice(0, -1).join("."),
|
|
189
|
-
`tests.json`
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
const featuresPath = path.join(
|
|
193
|
-
"./docs/",
|
|
194
|
-
platform,
|
|
195
|
-
entryPoint.split(".").slice(0, -1).join("."),
|
|
196
|
-
`featurePrompt.txt`
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
fs.writeFileSync(
|
|
200
|
-
promptPath,
|
|
201
|
-
`
|
|
202
|
-
${addableFiles
|
|
203
|
-
.map((x) => {
|
|
204
|
-
return `/add ${x}`;
|
|
205
|
-
})
|
|
206
|
-
.join("\n")}
|
|
207
|
-
|
|
208
|
-
/read ${lintPather(entryPoint, platform)}
|
|
209
|
-
/read ${tscPather(entryPoint, platform)}
|
|
210
|
-
/read ${testPaths}
|
|
211
|
-
|
|
212
|
-
/load ${featuresPath}
|
|
213
|
-
|
|
214
|
-
/code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${tscPather(
|
|
215
|
-
entryPoint,
|
|
216
|
-
platform
|
|
217
|
-
)}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPather(
|
|
218
|
-
entryPoint,
|
|
219
|
-
platform
|
|
220
|
-
)}"
|
|
221
|
-
`
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
type IOutputs = Record<
|
|
226
|
-
string,
|
|
227
|
-
{
|
|
228
|
-
entryPoint: string;
|
|
229
|
-
inputs: Record<string, string>;
|
|
230
|
-
}
|
|
231
|
-
>;
|
|
232
|
-
|
|
233
|
-
const metafileOutputs = async (platform: "web" | "node") => {
|
|
234
|
-
const metafile = JSON.parse(
|
|
235
|
-
fs.readFileSync(`docs/${platform}/metafile.json`).toString()
|
|
236
|
-
).metafile;
|
|
237
|
-
|
|
238
|
-
if (!metafile) return;
|
|
239
|
-
|
|
240
|
-
const outputs: IOutputs = metafile.outputs;
|
|
241
|
-
|
|
242
|
-
Object.keys(outputs).forEach(async (k) => {
|
|
243
|
-
const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
|
|
244
|
-
if (!fs.existsSync(i)) return false;
|
|
245
|
-
if (i.startsWith("node_modules")) return false;
|
|
246
|
-
return true;
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
const f = `${k.split(".").slice(0, -1).join(".")}/`;
|
|
250
|
-
if (!fs.existsSync(f)) {
|
|
251
|
-
fs.mkdirSync(f);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const entrypoint = outputs[k].entryPoint;
|
|
255
|
-
|
|
256
|
-
if (entrypoint) {
|
|
257
|
-
const changeDigest = await filesHash(addableFiles);
|
|
258
|
-
|
|
259
|
-
if (changeDigest === changes[entrypoint]) {
|
|
260
|
-
// skip
|
|
261
|
-
} else {
|
|
262
|
-
changes[entrypoint] = changeDigest;
|
|
263
|
-
tscCheck({ platform, addableFiles, entrypoint });
|
|
264
|
-
eslintCheck(entrypoint, platform, addableFiles);
|
|
265
|
-
makePrompt(entrypoint, addableFiles, platform);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
|
|
271
18
|
import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
272
19
|
const rawConfig: IBaseConfig = module.default;
|
|
273
20
|
|
|
@@ -276,123 +23,12 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
276
23
|
buildDir: process.cwd() + "/" + rawConfig.outdir,
|
|
277
24
|
};
|
|
278
25
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
let pm: PM_Main | undefined = new PM_Main(config);
|
|
26
|
+
const pm = new PM_Main(config);
|
|
27
|
+
pm.start();
|
|
282
28
|
|
|
283
|
-
console.log(ansiC.inverse(`Press 'q' to shutdown gracefully`));
|
|
284
29
|
process.stdin.on("keypress", (str, key) => {
|
|
285
30
|
if (key.name === "q") {
|
|
286
|
-
|
|
287
|
-
ansiC.inverse("Testeranto-Run is shutting down gracefully...")
|
|
288
|
-
);
|
|
289
|
-
mode = "PROD";
|
|
290
|
-
// onDone();
|
|
291
|
-
nodeMetafileWatcher.close();
|
|
292
|
-
webMetafileWatcher.close();
|
|
293
|
-
pm.shutDown();
|
|
31
|
+
pm.stop();
|
|
294
32
|
}
|
|
295
33
|
});
|
|
296
|
-
|
|
297
|
-
metafileOutputs("node");
|
|
298
|
-
const nodeMetafileWatcher = watch(
|
|
299
|
-
"docs/node/metafile.json",
|
|
300
|
-
async (e, filename) => {
|
|
301
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename} (node)`)));
|
|
302
|
-
metafileOutputs("node");
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
metafileOutputs("web");
|
|
307
|
-
const webMetafileWatcher = watch(
|
|
308
|
-
"docs/web/metafile.json",
|
|
309
|
-
async (e, filename) => {
|
|
310
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename} (web)`)));
|
|
311
|
-
metafileOutputs("web");
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
|
|
315
|
-
await pm.startPuppeteer(
|
|
316
|
-
{
|
|
317
|
-
slowMo: 1,
|
|
318
|
-
// timeout: 1,
|
|
319
|
-
waitForInitialPage: false,
|
|
320
|
-
executablePath:
|
|
321
|
-
// process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
|
|
322
|
-
"/opt/homebrew/bin/chromium",
|
|
323
|
-
headless: true,
|
|
324
|
-
dumpio: true,
|
|
325
|
-
// timeout: 0,
|
|
326
|
-
devtools: true,
|
|
327
|
-
|
|
328
|
-
args: [
|
|
329
|
-
"--auto-open-devtools-for-tabs",
|
|
330
|
-
`--remote-debugging-port=3234`,
|
|
331
|
-
|
|
332
|
-
// "--disable-features=IsolateOrigins,site-per-process",
|
|
333
|
-
"--disable-site-isolation-trials",
|
|
334
|
-
"--allow-insecure-localhost",
|
|
335
|
-
"--allow-file-access-from-files",
|
|
336
|
-
"--allow-running-insecure-content",
|
|
337
|
-
|
|
338
|
-
"--disable-dev-shm-usage",
|
|
339
|
-
"--disable-extensions",
|
|
340
|
-
"--disable-gpu",
|
|
341
|
-
"--disable-setuid-sandbox",
|
|
342
|
-
"--disable-site-isolation-trials",
|
|
343
|
-
"--disable-web-security",
|
|
344
|
-
"--no-first-run",
|
|
345
|
-
"--no-sandbox",
|
|
346
|
-
"--no-startup-window",
|
|
347
|
-
// "--no-zygote",
|
|
348
|
-
"--reduce-security-for-testing",
|
|
349
|
-
"--remote-allow-origins=*",
|
|
350
|
-
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
351
|
-
// "--disable-features=IsolateOrigins",
|
|
352
|
-
// "--remote-allow-origins=ws://localhost:3234",
|
|
353
|
-
// "--single-process",
|
|
354
|
-
// "--unsafely-treat-insecure-origin-as-secure",
|
|
355
|
-
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
356
|
-
|
|
357
|
-
// "--disk-cache-dir=/dev/null",
|
|
358
|
-
// "--disk-cache-size=1",
|
|
359
|
-
// "--start-maximized",
|
|
360
|
-
],
|
|
361
|
-
},
|
|
362
|
-
"."
|
|
363
|
-
);
|
|
364
|
-
|
|
365
|
-
const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
|
|
366
|
-
|
|
367
|
-
Object.entries(nodeEntryPoints).forEach(
|
|
368
|
-
([k, outputFile]: [string, string]) => {
|
|
369
|
-
pm.launchNode(k, outputFile);
|
|
370
|
-
try {
|
|
371
|
-
watch(outputFile, async (e, filename) => {
|
|
372
|
-
const hash = await fileHash(outputFile);
|
|
373
|
-
if (fileHashes[k] !== hash) {
|
|
374
|
-
fileHashes[k] = hash;
|
|
375
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
|
|
376
|
-
pm.launchNode(k, outputFile);
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
} catch (e) {
|
|
380
|
-
console.error(e);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
);
|
|
384
|
-
|
|
385
|
-
Object.entries(webEntryPoints).forEach(
|
|
386
|
-
([k, outputFile]: [string, string]) => {
|
|
387
|
-
pm.launchWeb(k, outputFile);
|
|
388
|
-
watch(outputFile, async (e, filename) => {
|
|
389
|
-
const hash = await fileHash(outputFile);
|
|
390
|
-
if (fileHashes[k] !== hash) {
|
|
391
|
-
fileHashes[k] = hash;
|
|
392
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
|
|
393
|
-
pm.launchWeb(k, outputFile);
|
|
394
|
-
}
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
);
|
|
398
34
|
});
|
package/src/utils.ts
CHANGED
|
@@ -2,6 +2,16 @@ import path from "path";
|
|
|
2
2
|
|
|
3
3
|
import { IRunTime, IBuiltConfig } from "./lib";
|
|
4
4
|
|
|
5
|
+
export type ISummary = Record<
|
|
6
|
+
string,
|
|
7
|
+
{
|
|
8
|
+
runTimeError?: number | "?";
|
|
9
|
+
typeErrors?: number | "?";
|
|
10
|
+
staticErrors?: number | "?";
|
|
11
|
+
prompt?: string | "?";
|
|
12
|
+
}
|
|
13
|
+
>;
|
|
14
|
+
|
|
5
15
|
export const destinationOfRuntime = (
|
|
6
16
|
f: string,
|
|
7
17
|
r: IRunTime,
|
package/tsc.log
CHANGED
|
@@ -14,15 +14,17 @@ src/Node.ts(58,56): error TS2345: Argument of type 'PM_Node' is not assignable t
|
|
|
14
14
|
Types of parameters 'cdpPage' and 'page' are incompatible.
|
|
15
15
|
Type 'string | undefined' is not assignable to type 'CdpPage'.
|
|
16
16
|
Type 'undefined' is not assignable to type 'CdpPage'.
|
|
17
|
-
src/PM/main.ts(
|
|
18
|
-
src/PM/main.ts(
|
|
19
|
-
src/PM/main.ts(
|
|
20
|
-
src/PM/main.ts(
|
|
17
|
+
src/PM/main.ts(272,24): error TS18048: 'page' is possibly 'undefined'.
|
|
18
|
+
src/PM/main.ts(303,9): error TS2322: Type 'string' is not assignable to type '`${string}.webm`'.
|
|
19
|
+
src/PM/main.ts(306,17): error TS2538: Type 'undefined' cannot be used as an index type.
|
|
20
|
+
src/PM/main.ts(341,3): error TS2416: Property 'customScreenShot' in type 'PM_Main' is not assignable to the same property in base type 'PM'.
|
|
21
21
|
Type '(opts: object, cdpPage?: CdpPage | undefined) => void' is not assignable to type '(opts: object, page?: string | undefined) => any'.
|
|
22
22
|
Types of parameters 'cdpPage' and 'page' are incompatible.
|
|
23
23
|
Type 'string | undefined' is not assignable to type 'CdpPage | undefined'.
|
|
24
24
|
Type 'string' is not assignable to type 'CdpPage'.
|
|
25
|
-
src/PM/main.ts(
|
|
25
|
+
src/PM/main.ts(772,24): error TS2339: Property 'status' does not exist on type '{ runTimeError?: number | "?" | undefined; typeErrors?: number | "?" | undefined; staticErrors?: number | "?" | undefined; prompt?: string | undefined; }'.
|
|
26
|
+
src/PM/main.ts(776,24): error TS2339: Property 'status' does not exist on type '{ runTimeError?: number | "?" | undefined; typeErrors?: number | "?" | undefined; staticErrors?: number | "?" | undefined; prompt?: string | undefined; }'.
|
|
27
|
+
src/PM/main.ts(1035,15): error TS2345: Argument of type 'Page' is not assignable to parameter of type 'Page | PromiseLike<Page>'.
|
|
26
28
|
Type 'import("/Users/adam/Code/testeranto/node_modules/puppeteer-core/lib/types").Page' is not assignable to type 'import("/Users/adam/Code/testeranto/node_modules/puppeteer-core/lib/esm/puppeteer/api/Page").Page'.
|
|
27
29
|
Property '#private' in type 'Page' refers to a different member that cannot be accessed from within type 'Page'.
|
|
28
30
|
src/PM/node.ts(88,3): error TS2416: Property 'customScreenShot' in type 'PM_Node' is not assignable to the same property in base type 'PM'.
|
|
@@ -30,7 +32,7 @@ src/PM/node.ts(88,3): error TS2416: Property 'customScreenShot' in type 'PM_Node
|
|
|
30
32
|
Types of parameters 'cdpPage' and 'page' are incompatible.
|
|
31
33
|
Type 'string | undefined' is not assignable to type 'CdpPage'.
|
|
32
34
|
Type 'undefined' is not assignable to type 'CdpPage'.
|
|
33
|
-
src/ReportClient.tsx(
|
|
35
|
+
src/ReportClient.tsx(161,38): error TS2345: Argument of type 'FunctionComponentElement<{}>' is not assignable to parameter of type 'ReactNode'.
|
|
34
36
|
Property 'children' is missing in type 'FunctionComponentElement<{}>' but required in type 'ReactPortal'.
|
|
35
37
|
src/SubPackages/react-dom/component/web.ts(90,13): error TS2345: Argument of type 'CElement<any, TesterantoComponent>' is not assignable to parameter of type 'ReactNode'.
|
|
36
38
|
Property 'children' is missing in type 'ComponentElement<any, TesterantoComponent>' but required in type 'ReactPortal'.
|