testeranto 0.114.1 → 0.121.1
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/README.md +6 -1
- package/bundle.js +1 -1
- package/dist/common/Init.js +55 -61
- package/dist/common/PM/base.js +233 -0
- package/dist/common/PM/main.js +217 -434
- package/dist/common/build.js +113 -92
- package/dist/common/defaultConfig.js +2 -2
- package/dist/common/esbuildConfigs/index.js +1 -1
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +7 -3
- package/dist/common/esbuildConfigs/node.js +5 -3
- package/dist/common/esbuildConfigs/web.js +3 -3
- package/dist/common/init-docs.js +2 -46
- package/dist/common/lib/abstractBase.js +60 -54
- package/dist/common/lib/basebuilder.js +7 -8
- package/dist/common/lib/classBuilder.js +8 -5
- package/dist/common/lib/core.js +6 -18
- package/dist/common/lib/index.js +6 -1
- package/dist/common/run.js +10 -2
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/utils.js +9 -21
- package/dist/module/Init.js +55 -61
- package/dist/module/PM/base.js +226 -0
- package/dist/module/PM/main.js +218 -435
- package/dist/module/Project.js +117 -0
- package/dist/module/TestReport.js +13 -4
- package/dist/module/build.js +113 -92
- package/dist/module/defaultConfig.js +2 -2
- package/dist/module/esbuildConfigs/index.js +1 -1
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +7 -3
- package/dist/module/esbuildConfigs/node.js +5 -3
- package/dist/module/esbuildConfigs/web.js +3 -3
- package/dist/module/init-docs.js +2 -13
- package/dist/module/lib/abstractBase.js +60 -54
- package/dist/module/lib/basebuilder.js +7 -8
- package/dist/module/lib/classBuilder.js +8 -5
- package/dist/module/lib/core.js +6 -18
- package/dist/module/lib/index.js +6 -1
- package/dist/module/run.js +10 -2
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/utils.js +8 -17
- package/dist/prebuild/Project.css +11367 -0
- package/dist/prebuild/Project.js +24640 -0
- package/dist/prebuild/ReportClient.js +1 -1
- package/dist/prebuild/TestReport.js +9 -11
- package/dist/prebuild/build.mjs +142 -81
- package/dist/prebuild/init-docs.mjs +28 -83
- package/dist/prebuild/run.mjs +618 -537
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Init.d.ts +1 -1
- package/dist/types/PM/base.d.ts +38 -0
- package/dist/types/PM/main.d.ts +20 -44
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +1 -1
- package/dist/types/esbuildConfigs/node.d.ts +1 -1
- package/dist/types/esbuildConfigs/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +19 -11
- package/dist/types/lib/basebuilder.d.ts +1 -2
- package/dist/types/lib/index.d.ts +3 -3
- package/dist/types/lib/types.d.ts +2 -5
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/utils.d.ts +4 -7
- package/package.json +6 -5
- package/src/Init.ts +60 -68
- package/src/PM/base.ts +301 -0
- package/src/PM/main.ts +276 -567
- package/src/Project.tsx +197 -0
- package/src/ReportClient.tsx +1 -1
- package/src/TestReport.tsx +30 -15
- package/src/build.ts +140 -104
- package/src/defaultConfig.ts +2 -2
- package/src/esbuildConfigs/index.ts +1 -1
- package/src/esbuildConfigs/inputFilesPlugin.ts +7 -6
- package/src/esbuildConfigs/node.ts +5 -3
- package/src/esbuildConfigs/web.ts +4 -3
- package/src/init-docs.ts +2 -15
- package/src/lib/abstractBase.ts +113 -93
- package/src/lib/basebuilder.ts +8 -9
- package/src/lib/classBuilder.ts +11 -10
- package/src/lib/core.ts +15 -27
- package/src/lib/index.ts +13 -6
- package/src/lib/types.ts +3 -8
- package/src/run.ts +21 -5
- package/src/utils.ts +27 -39
- package/tsc.log +12 -23
- package/dist/common/puppeteerConfiger.js +0 -24
- package/dist/module/puppeteerConfiger.js +0 -19
- package/dist/types/puppeteerConfiger.d.ts +0 -4
- package/src/puppeteerConfiger.ts +0 -26
package/src/Project.tsx
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import ReactDom from "react-dom/client";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
5
|
+
import "./style.css"
|
|
6
|
+
|
|
7
|
+
import { IRunTime, ITestTypes, IBuiltConfig, IConfigV2 } from "./lib";
|
|
8
|
+
import { Footer } from "./Footer";
|
|
9
|
+
import { Table } from "react-bootstrap";
|
|
10
|
+
// import { ISummary } from "./utils";
|
|
11
|
+
|
|
12
|
+
type ISummary = {
|
|
13
|
+
staticAnalysis: number | "?";
|
|
14
|
+
typeErrors: number | "?";
|
|
15
|
+
bddErrors: number | "?";
|
|
16
|
+
prompt: string | "?";
|
|
17
|
+
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type ICollation = {
|
|
21
|
+
name: string;
|
|
22
|
+
runTime: IRunTime;
|
|
23
|
+
tr: {
|
|
24
|
+
ports: number;
|
|
25
|
+
};
|
|
26
|
+
sidecars: ITestTypes[];
|
|
27
|
+
staticAnalysis: number | "?";
|
|
28
|
+
typeErrors: number | "?";
|
|
29
|
+
bddErrors: number | "?";
|
|
30
|
+
prompt: string | "?";
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type ICollations = ICollation[];
|
|
34
|
+
|
|
35
|
+
const BigBoard = () => {
|
|
36
|
+
|
|
37
|
+
const projects = JSON.parse(document.getElementById('bigConfig').innerHTML) as string[];
|
|
38
|
+
// const projects = Object.keys(bigConfig.projects);
|
|
39
|
+
|
|
40
|
+
// const [configs, setConfigs] = useState<IBuiltConfig>();
|
|
41
|
+
// useEffect(() => {
|
|
42
|
+
// (async () => {
|
|
43
|
+
// fetch('/kokomoBay/docs/testeranto.json')
|
|
44
|
+
// .then(response => response.json())
|
|
45
|
+
// .then(json => {
|
|
46
|
+
// setConfigs(json)
|
|
47
|
+
// })
|
|
48
|
+
// .catch(error => console.error(error));
|
|
49
|
+
|
|
50
|
+
// })();
|
|
51
|
+
// }, []);
|
|
52
|
+
|
|
53
|
+
// const [bigBoard, setBigBoard] = useState<Record<string, ISummary>>({});
|
|
54
|
+
// useEffect(() => {
|
|
55
|
+
// (async () => {
|
|
56
|
+
// fetch('/kokomoBay/docs/summary.json')
|
|
57
|
+
// .then(response => response.json())
|
|
58
|
+
// .then(json => {
|
|
59
|
+
// setBigBoard(json)
|
|
60
|
+
// })
|
|
61
|
+
// .catch(error => console.error(error));
|
|
62
|
+
|
|
63
|
+
// })();
|
|
64
|
+
// }, []);
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
const [summary, setSummary] = useState<[
|
|
68
|
+
string,
|
|
69
|
+
IBuiltConfig,
|
|
70
|
+
ISummary
|
|
71
|
+
][]>();
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
(async () => {
|
|
74
|
+
|
|
75
|
+
const x: Promise<[string, IBuiltConfig, ISummary]>[] = projects.map(async (p) => {
|
|
76
|
+
return [
|
|
77
|
+
p,
|
|
78
|
+
(await (await fetch(`/kokomoBay/testeranto/reports/${p}/config.json`)).json()) as IBuiltConfig,
|
|
79
|
+
(await (await fetch(`/kokomoBay/testeranto/reports/${p}/summary.json`)).json()) as ISummary
|
|
80
|
+
] as [string, IBuiltConfig, ISummary]
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
Promise.all(x).then((v) => {
|
|
84
|
+
setSummary(v)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
// fetch('/kokomoBay/docs/summary.json')
|
|
88
|
+
// .then(response => response.json())
|
|
89
|
+
// .then(json => {
|
|
90
|
+
// setBigBoard(json)
|
|
91
|
+
// })
|
|
92
|
+
// .catch(error => console.error(error));
|
|
93
|
+
|
|
94
|
+
})();
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
if (!summary || summary?.length === 0) {
|
|
99
|
+
return <div>loading...</div>
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
console.log("summary", summary)
|
|
103
|
+
// const collated: ICollations = configs.tests.map((c) => {
|
|
104
|
+
// return {
|
|
105
|
+
// ...bigBoard[c[0]],
|
|
106
|
+
// name: c[0],
|
|
107
|
+
// runTime: c[1],
|
|
108
|
+
// tr: c[2],
|
|
109
|
+
// sidecars: c[3],
|
|
110
|
+
// staticAnalysis: bigBoard[c[0]].staticErrors,
|
|
111
|
+
// typeErrors: bigBoard[c[0]].typeErrors,
|
|
112
|
+
// bddErrors: bigBoard[c[0]].runTimeError,
|
|
113
|
+
// prompt: bigBoard[c[0]].prompt
|
|
114
|
+
// } as ICollation
|
|
115
|
+
// });
|
|
116
|
+
|
|
117
|
+
function copyToClipboard(text) {
|
|
118
|
+
navigator.clipboard.writeText(text)
|
|
119
|
+
.then(() => {
|
|
120
|
+
console.log('Text copied to clipboard');
|
|
121
|
+
})
|
|
122
|
+
.catch(err => {
|
|
123
|
+
console.error('Error copying text: ', err);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return <div >
|
|
128
|
+
|
|
129
|
+
<Table striped bordered hover>
|
|
130
|
+
<thead>
|
|
131
|
+
<tr>
|
|
132
|
+
<th>project</th>
|
|
133
|
+
<th>platform</th>
|
|
134
|
+
<th>BDD errors</th>
|
|
135
|
+
<th>Lint errors</th>
|
|
136
|
+
<th>Type errors</th>
|
|
137
|
+
<th>prompt</th>
|
|
138
|
+
</tr>
|
|
139
|
+
|
|
140
|
+
</thead>
|
|
141
|
+
|
|
142
|
+
<tbody>
|
|
143
|
+
{
|
|
144
|
+
...summary.map((s) => {
|
|
145
|
+
return <>
|
|
146
|
+
<tr>
|
|
147
|
+
<th>{s[0]}</th>
|
|
148
|
+
</tr>
|
|
149
|
+
{
|
|
150
|
+
...s[1].tests.map((t) => {
|
|
151
|
+
|
|
152
|
+
const x = `${s[0]}/${t[0].split(".").slice(0, -1).join(".")}/${t[1]}`
|
|
153
|
+
const y = s[2][t[0]];
|
|
154
|
+
|
|
155
|
+
return <tr>
|
|
156
|
+
<td>{t[0]}</td>
|
|
157
|
+
<td>{t[1]}</td>
|
|
158
|
+
<td><a href={`/kokomoBay/testeranto/reports/${x}/littleBoard.html`}>{y.runTimeError}</a></td>
|
|
159
|
+
<td><a href={`/kokomoBay/testeranto/reports/${x}/lint_errors.json`}>{y.staticErrors}</a></td>
|
|
160
|
+
<td><a href={`/kokomoBay/testeranto/reports/${x}/type_errors.txt`}>{y.typeErrors}</a></td>
|
|
161
|
+
<td>
|
|
162
|
+
<pre>
|
|
163
|
+
|
|
164
|
+
{s[2][t[0]].prompt}
|
|
165
|
+
{/* <button onClick={() => {
|
|
166
|
+
copyToClipboard(s[2][t[0]].prompt)
|
|
167
|
+
}}>prompt</button> */}
|
|
168
|
+
</pre>
|
|
169
|
+
</td>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
</tr>
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
</>
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
</tbody>
|
|
181
|
+
|
|
182
|
+
</Table>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
<Footer />
|
|
187
|
+
</div>
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
191
|
+
const elem = document.getElementById("root");
|
|
192
|
+
if (elem) {
|
|
193
|
+
ReactDom.createRoot(elem).render(React.createElement(BigBoard, {}, []));
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
console.log("hello BigBoard!")
|
package/src/ReportClient.tsx
CHANGED
|
@@ -30,7 +30,7 @@ const BigBoard = () => {
|
|
|
30
30
|
const [configs, setConfigs] = useState<IBuiltConfig>();
|
|
31
31
|
useEffect(() => {
|
|
32
32
|
(async () => {
|
|
33
|
-
fetch(
|
|
33
|
+
fetch(`/kokomoBay/testeranto/reports${t}/config.json`)
|
|
34
34
|
.then(response => response.json())
|
|
35
35
|
.then(json => {
|
|
36
36
|
setConfigs(json)
|
package/src/TestReport.tsx
CHANGED
|
@@ -41,6 +41,7 @@ const TestPane = ({ given }: {
|
|
|
41
41
|
|
|
42
42
|
return <div> <Tab.Container id="TestPane-tabs" defaultActiveKey="first">
|
|
43
43
|
<Row>
|
|
44
|
+
|
|
44
45
|
<Col sm={3}>
|
|
45
46
|
<Nav variant="pills" className="flex-column">
|
|
46
47
|
|
|
@@ -61,7 +62,7 @@ const TestPane = ({ given }: {
|
|
|
61
62
|
|
|
62
63
|
|
|
63
64
|
</Col>
|
|
64
|
-
<Col sm={
|
|
65
|
+
<Col sm={6}>
|
|
65
66
|
<Tab.Content>
|
|
66
67
|
|
|
67
68
|
<Tab.Pane eventKey={`bdd-features`}>
|
|
@@ -87,18 +88,18 @@ const TestPane = ({ given }: {
|
|
|
87
88
|
|
|
88
89
|
const BddPage = () => {
|
|
89
90
|
|
|
90
|
-
const [configs, setConfigs] = useState<IBuiltConfig>();
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
// const [configs, setConfigs] = useState<IBuiltConfig>();
|
|
92
|
+
// useEffect(() => {
|
|
93
|
+
// (async () => {
|
|
94
|
+
// fetch('../config.json')
|
|
95
|
+
// .then(response => response.json())
|
|
96
|
+
// .then(json => {
|
|
97
|
+
// setConfigs(json)
|
|
98
|
+
// })
|
|
99
|
+
// .catch(error => console.error(error));
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
}, []);
|
|
101
|
+
// })();
|
|
102
|
+
// }, []);
|
|
102
103
|
|
|
103
104
|
|
|
104
105
|
const [bddErrors, setBddErrors] = useState<{
|
|
@@ -119,9 +120,16 @@ const BddPage = () => {
|
|
|
119
120
|
(async () => {
|
|
120
121
|
setBddErrors(await (await fetch(`tests.json`)).json());
|
|
121
122
|
})();
|
|
122
|
-
}, [
|
|
123
|
+
}, []);
|
|
123
124
|
|
|
124
|
-
|
|
125
|
+
const [log, setLog] = useState<string>();
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
(async () => {
|
|
128
|
+
setLog(await (await fetch(`log.txt`)).text());
|
|
129
|
+
})();
|
|
130
|
+
}, []);
|
|
131
|
+
|
|
132
|
+
if (!bddErrors || !log) {
|
|
125
133
|
return <div>loading...</div>
|
|
126
134
|
}
|
|
127
135
|
|
|
@@ -132,6 +140,13 @@ const BddPage = () => {
|
|
|
132
140
|
<Row>
|
|
133
141
|
<Tab.Container id="root-tab-container" defaultActiveKey="first">
|
|
134
142
|
<Row>
|
|
143
|
+
|
|
144
|
+
<Col sm={3}>
|
|
145
|
+
<pre><code>{log}</code></pre>
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
</Col>
|
|
149
|
+
|
|
135
150
|
<Col sm={3}>
|
|
136
151
|
<Nav variant="pills" className="flex-column">
|
|
137
152
|
|
|
@@ -147,7 +162,7 @@ const BddPage = () => {
|
|
|
147
162
|
|
|
148
163
|
</Nav>
|
|
149
164
|
</Col>
|
|
150
|
-
<Col sm={
|
|
165
|
+
<Col sm={6}>
|
|
151
166
|
<Tab.Content>
|
|
152
167
|
{
|
|
153
168
|
...bddErrors.givens.map((g) =>
|
package/src/build.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ansiC from "ansi-colors";
|
|
1
2
|
import fs, { watch } from "fs";
|
|
2
3
|
import path from "path";
|
|
3
4
|
import readline from "readline";
|
|
@@ -13,39 +14,32 @@ import {
|
|
|
13
14
|
IBaseConfig,
|
|
14
15
|
IRunTime,
|
|
15
16
|
IBuiltConfig,
|
|
17
|
+
IConfigV2,
|
|
16
18
|
} from "./lib/index.js";
|
|
17
19
|
|
|
18
20
|
readline.emitKeypressEvents(process.stdin);
|
|
19
21
|
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
tests: ITestTypes[],
|
|
23
|
-
payload = {
|
|
24
|
-
nodeEntryPoints: {},
|
|
25
|
-
webEntryPoints: {},
|
|
26
|
-
}
|
|
27
|
-
): IRunnables => {
|
|
28
|
-
return tests.reduce((pt, cv, cndx, cry) => {
|
|
29
|
-
if (cv[1] === "node") {
|
|
30
|
-
pt.nodeEntryPoints[cv[0]] = path.resolve(
|
|
31
|
-
`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
32
|
-
);
|
|
33
|
-
} else if (cv[1] === "web") {
|
|
34
|
-
pt.webEntryPoints[cv[0]] = path.resolve(
|
|
35
|
-
`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
23
|
+
let testName = process.argv[2];
|
|
38
24
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
let mode = process.argv[3] as "once" | "dev";
|
|
26
|
+
if (mode !== "once" && mode !== "dev") {
|
|
27
|
+
console.error(`The 4th argument should be 'dev' or 'once', not '${mode}'.`);
|
|
28
|
+
process.exit(-1);
|
|
29
|
+
}
|
|
42
30
|
|
|
43
|
-
|
|
44
|
-
}, payload as IRunnables);
|
|
45
|
-
};
|
|
31
|
+
console.log("testeranto is building", testName, mode);
|
|
46
32
|
|
|
47
|
-
import(process.cwd() + "/" +
|
|
48
|
-
const
|
|
33
|
+
import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
|
|
34
|
+
const bigConfig: IConfigV2 = module.default;
|
|
35
|
+
|
|
36
|
+
const project = bigConfig.projects[testName];
|
|
37
|
+
if (!project) {
|
|
38
|
+
console.error("no project found for", testName, "in testeranto.config.ts");
|
|
39
|
+
process.exit(-1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const rawConfig: IBaseConfig = bigConfig.projects[testName];
|
|
49
43
|
|
|
50
44
|
const getSecondaryEndpointsPoints = (runtime?: IRunTime): string[] => {
|
|
51
45
|
const meta = (ts: ITestTypes[], st: Set<string>): Set<string> => {
|
|
@@ -64,15 +58,31 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
64
58
|
|
|
65
59
|
const config: IBuiltConfig = {
|
|
66
60
|
...rawConfig,
|
|
67
|
-
buildDir: process.cwd() + "/" +
|
|
61
|
+
buildDir: process.cwd() + "/testeranto/bundles/" + testName,
|
|
68
62
|
};
|
|
69
63
|
|
|
64
|
+
console.log(
|
|
65
|
+
`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`
|
|
66
|
+
);
|
|
67
|
+
process.stdin.on("keypress", (str, key) => {
|
|
68
|
+
if (key.name === "q") {
|
|
69
|
+
console.log("Testeranto-Build is shutting down...");
|
|
70
|
+
mode = "once";
|
|
71
|
+
onDone();
|
|
72
|
+
} else if (key.name === "x") {
|
|
73
|
+
console.log("Testeranto-Build is shutting down forcefully...");
|
|
74
|
+
process.exit(-1);
|
|
75
|
+
} else {
|
|
76
|
+
console.log(
|
|
77
|
+
`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
70
81
|
let nodeDone: boolean = false;
|
|
71
82
|
let webDone: boolean = false;
|
|
72
|
-
|
|
83
|
+
|
|
73
84
|
let status: "build" | "built" = "build";
|
|
74
|
-
|
|
75
|
-
// const fileHashes = {};
|
|
85
|
+
|
|
76
86
|
const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
|
|
77
87
|
|
|
78
88
|
const onNodeDone = () => {
|
|
@@ -89,85 +99,81 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
89
99
|
if (nodeDone && webDone) {
|
|
90
100
|
status = "built";
|
|
91
101
|
}
|
|
92
|
-
if (nodeDone && webDone &&
|
|
93
|
-
|
|
94
|
-
// console.log("watching", outputFile);
|
|
95
|
-
// try {
|
|
96
|
-
// watch(outputFile, async (filename) => {
|
|
97
|
-
// const hash = await fileHash(outputFile);
|
|
98
|
-
// if (fileHashes[k] !== hash) {
|
|
99
|
-
// fileHashes[k] = hash;
|
|
100
|
-
// console.log(`< ${filename} `);
|
|
101
|
-
// pm.launchNode(k, outputFile);
|
|
102
|
-
// }
|
|
103
|
-
// });
|
|
104
|
-
// } catch (e) {
|
|
105
|
-
// console.error(e);
|
|
106
|
-
// }
|
|
107
|
-
// });
|
|
108
|
-
// Object.entries(webEntryPoints).forEach(([k, outputFile]) => {
|
|
109
|
-
// console.log("watching", outputFile);
|
|
110
|
-
// watch(outputFile, async (filename) => {
|
|
111
|
-
// const hash = await fileHash(outputFile);
|
|
112
|
-
// console.log(`< ${filename} ${hash}`);
|
|
113
|
-
// if (fileHashes[k] !== hash) {
|
|
114
|
-
// fileHashes[k] = hash;
|
|
115
|
-
// pm.launchWeb(k, outputFile);
|
|
116
|
-
// }
|
|
117
|
-
// });
|
|
118
|
-
// });
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (nodeDone && webDone && mode === "PROD") {
|
|
122
|
-
console.log("Testeranto-EsBuild is all done. Goodbye!");
|
|
102
|
+
if (nodeDone && webDone && mode === "once") {
|
|
103
|
+
console.log(ansiC.inverse(`${testName} has been built. Goodbye.`));
|
|
123
104
|
process.exit();
|
|
124
|
-
} else {
|
|
125
|
-
if (mode === "PROD") {
|
|
126
|
-
console.log("waiting for tests to finish");
|
|
127
|
-
console.log(
|
|
128
|
-
JSON.stringify(
|
|
129
|
-
{
|
|
130
|
-
nodeDone: nodeDone,
|
|
131
|
-
webDone: webDone,
|
|
132
|
-
mode: mode,
|
|
133
|
-
},
|
|
134
|
-
null,
|
|
135
|
-
2
|
|
136
|
-
)
|
|
137
|
-
);
|
|
138
|
-
} else {
|
|
139
|
-
console.log("waiting for tests to change");
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (config.devMode) {
|
|
143
|
-
console.log("ready and watching for changes...");
|
|
144
|
-
} else {
|
|
145
|
-
// pm.shutDown();
|
|
146
|
-
}
|
|
147
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
148
105
|
}
|
|
149
106
|
};
|
|
150
107
|
|
|
151
|
-
|
|
152
|
-
`
|
|
108
|
+
if (!fs.existsSync(`testeranto/reports/${testName}`)) {
|
|
109
|
+
fs.mkdirSync(`testeranto/reports/${testName}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
fs.writeFileSync(
|
|
113
|
+
`${process.cwd()}/testeranto/reports/${testName}/index.html`,
|
|
114
|
+
`
|
|
115
|
+
<!DOCTYPE html>
|
|
116
|
+
<html lang="en">
|
|
117
|
+
|
|
118
|
+
<head>
|
|
119
|
+
<meta name="description" content="Webpage description goes here" />
|
|
120
|
+
<meta charset="utf-8" />
|
|
121
|
+
<title>kokomoBay - testeranto</title>
|
|
122
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
123
|
+
<meta name="author" content="" />
|
|
124
|
+
|
|
125
|
+
<link rel="stylesheet" href="/kokomoBay/testeranto/ReportClient.css" />
|
|
126
|
+
<script type="module" src="/kokomoBay/testeranto/ReportClient.js"></script>
|
|
127
|
+
|
|
128
|
+
</head>
|
|
129
|
+
|
|
130
|
+
<body>
|
|
131
|
+
<div id="root">
|
|
132
|
+
react is loading
|
|
133
|
+
</div>
|
|
134
|
+
</body>
|
|
135
|
+
|
|
136
|
+
</html>
|
|
137
|
+
`
|
|
153
138
|
);
|
|
154
|
-
process.stdin.on("keypress", (str, key) => {
|
|
155
|
-
if (key.name === "q") {
|
|
156
|
-
console.log("Testeranto-Build is shutting down...");
|
|
157
|
-
mode = "PROD";
|
|
158
|
-
onDone();
|
|
159
|
-
}
|
|
160
|
-
if (key.name === "x") {
|
|
161
|
-
console.log("Testeranto-Build is shutting down forcefully...");
|
|
162
|
-
process.exit(-1);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
139
|
|
|
166
140
|
fs.writeFileSync(
|
|
167
|
-
|
|
141
|
+
`testeranto/reports/${testName}/config.json`,
|
|
168
142
|
JSON.stringify(config, null, 2)
|
|
169
143
|
);
|
|
170
144
|
|
|
145
|
+
fs.writeFileSync(
|
|
146
|
+
`${process.cwd()}/testeranto/index.html`,
|
|
147
|
+
`
|
|
148
|
+
<!DOCTYPE html>
|
|
149
|
+
<html lang="en">
|
|
150
|
+
|
|
151
|
+
<head>
|
|
152
|
+
<meta name="description" content="Webpage description goes here" />
|
|
153
|
+
<meta charset="utf-8" />
|
|
154
|
+
<title>kokomoBay - testeranto</title>
|
|
155
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
156
|
+
<meta name="author" content="" />
|
|
157
|
+
|
|
158
|
+
<script type="application/json" id="bigConfig">
|
|
159
|
+
${JSON.stringify(Object.keys(bigConfig.projects))}
|
|
160
|
+
</script>
|
|
161
|
+
|
|
162
|
+
<link rel="stylesheet" href="/kokomoBay/testeranto/Project.css" />
|
|
163
|
+
<script type="module" src="/kokomoBay/testeranto/Project.js"></script>
|
|
164
|
+
|
|
165
|
+
</head>
|
|
166
|
+
|
|
167
|
+
<body>
|
|
168
|
+
<div id="root">
|
|
169
|
+
react is loading
|
|
170
|
+
</div>
|
|
171
|
+
</body>
|
|
172
|
+
|
|
173
|
+
</html>
|
|
174
|
+
`
|
|
175
|
+
);
|
|
176
|
+
|
|
171
177
|
Promise.resolve(
|
|
172
178
|
Promise.all(
|
|
173
179
|
[...getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
|
|
@@ -180,7 +186,7 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
180
186
|
.join(".");
|
|
181
187
|
|
|
182
188
|
const htmlFilePath = path.normalize(
|
|
183
|
-
`${process.cwd()}/${
|
|
189
|
+
`${process.cwd()}/testeranto/bundles/web/${testName}/${sourceDir.join(
|
|
184
190
|
"/"
|
|
185
191
|
)}/${sourceFileNameMinusJs}.html`
|
|
186
192
|
);
|
|
@@ -198,7 +204,7 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
198
204
|
)
|
|
199
205
|
);
|
|
200
206
|
|
|
201
|
-
glob(
|
|
207
|
+
glob(`${process.cwd()}/testeranto/bundles/${testName}/chunk-*.mjs`, {
|
|
202
208
|
ignore: "node_modules/**",
|
|
203
209
|
}).then((chunks) => {
|
|
204
210
|
chunks.forEach((chunk) => {
|
|
@@ -208,9 +214,11 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
208
214
|
|
|
209
215
|
await Promise.all([
|
|
210
216
|
esbuild
|
|
211
|
-
.context(
|
|
217
|
+
.context(
|
|
218
|
+
esbuildNodeConfiger(config, Object.keys(nodeEntryPoints), testName)
|
|
219
|
+
)
|
|
212
220
|
.then(async (nodeContext) => {
|
|
213
|
-
if (
|
|
221
|
+
if (mode === "dev") {
|
|
214
222
|
await nodeContext.watch().then((v) => {
|
|
215
223
|
onNodeDone();
|
|
216
224
|
});
|
|
@@ -223,9 +231,11 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
223
231
|
return nodeContext;
|
|
224
232
|
}),
|
|
225
233
|
esbuild
|
|
226
|
-
.context(
|
|
234
|
+
.context(
|
|
235
|
+
esbuildWebConfiger(config, Object.keys(webEntryPoints), testName)
|
|
236
|
+
)
|
|
227
237
|
.then(async (webContext) => {
|
|
228
|
-
if (
|
|
238
|
+
if (mode === "dev") {
|
|
229
239
|
await webContext.watch().then((v) => {
|
|
230
240
|
onWebDone();
|
|
231
241
|
});
|
|
@@ -238,3 +248,29 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
238
248
|
}),
|
|
239
249
|
]);
|
|
240
250
|
});
|
|
251
|
+
|
|
252
|
+
const getRunnables = (
|
|
253
|
+
tests: ITestTypes[],
|
|
254
|
+
payload = {
|
|
255
|
+
nodeEntryPoints: {},
|
|
256
|
+
webEntryPoints: {},
|
|
257
|
+
}
|
|
258
|
+
): IRunnables => {
|
|
259
|
+
return tests.reduce((pt, cv, cndx, cry) => {
|
|
260
|
+
if (cv[1] === "node") {
|
|
261
|
+
pt.nodeEntryPoints[cv[0]] = path.resolve(
|
|
262
|
+
`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
263
|
+
);
|
|
264
|
+
} else if (cv[1] === "web") {
|
|
265
|
+
pt.webEntryPoints[cv[0]] = path.resolve(
|
|
266
|
+
`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (cv[3].length) {
|
|
271
|
+
getRunnables(cv[3], payload);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return pt;
|
|
275
|
+
}, payload as IRunnables);
|
|
276
|
+
};
|
package/src/defaultConfig.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { IBaseConfig } from "./lib";
|
|
|
2
2
|
|
|
3
3
|
const config: IBaseConfig = {
|
|
4
4
|
src: "src",
|
|
5
|
-
outdir: "docs",
|
|
5
|
+
// outdir: "docs",
|
|
6
6
|
tests: [],
|
|
7
7
|
debugger: true,
|
|
8
8
|
clearScreen: false,
|
|
9
9
|
devMode: true,
|
|
10
10
|
minify: false,
|
|
11
|
-
outbase: ".",
|
|
11
|
+
// outbase: ".",
|
|
12
12
|
ports: ["3001"],
|
|
13
13
|
externals: [],
|
|
14
14
|
nodePlugins: [],
|
|
@@ -12,11 +12,16 @@ const register = (entrypoint: string, sources: string[]): void => {
|
|
|
12
12
|
|
|
13
13
|
export default (
|
|
14
14
|
platform: "web" | "node",
|
|
15
|
-
|
|
15
|
+
testName: string
|
|
16
16
|
): {
|
|
17
17
|
register: (entrypoint: string, sources: string[]) => void;
|
|
18
18
|
inputFilesPluginFactory: Plugin;
|
|
19
19
|
} => {
|
|
20
|
+
const d = `testeranto/bundles/${platform}/${testName}/`;
|
|
21
|
+
const f = `testeranto/bundles/${platform}/${testName}/metafile.json`;
|
|
22
|
+
if (!fs.existsSync(d)) {
|
|
23
|
+
fs.mkdirSync(d);
|
|
24
|
+
}
|
|
20
25
|
return {
|
|
21
26
|
register,
|
|
22
27
|
|
|
@@ -24,11 +29,7 @@ export default (
|
|
|
24
29
|
name: "metafileWriter",
|
|
25
30
|
setup(build) {
|
|
26
31
|
build.onEnd((result) => {
|
|
27
|
-
|
|
28
|
-
fs.writeFileSync(
|
|
29
|
-
`docs/${platform}/metafile.json`,
|
|
30
|
-
JSON.stringify(result, null, 2)
|
|
31
|
-
);
|
|
32
|
+
fs.writeFileSync(f, JSON.stringify(result, null, 2));
|
|
32
33
|
});
|
|
33
34
|
},
|
|
34
35
|
},
|