testeranto 0.113.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 -2
- 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 +7 -6
- 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
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import ReactDom from "react-dom/client";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
4
|
+
import "./style.css";
|
|
5
|
+
import { Footer } from "./Footer";
|
|
6
|
+
import { Table } from "react-bootstrap";
|
|
7
|
+
const BigBoard = () => {
|
|
8
|
+
const projects = JSON.parse(document.getElementById('bigConfig').innerHTML);
|
|
9
|
+
// const projects = Object.keys(bigConfig.projects);
|
|
10
|
+
// const [configs, setConfigs] = useState<IBuiltConfig>();
|
|
11
|
+
// useEffect(() => {
|
|
12
|
+
// (async () => {
|
|
13
|
+
// fetch('/kokomoBay/docs/testeranto.json')
|
|
14
|
+
// .then(response => response.json())
|
|
15
|
+
// .then(json => {
|
|
16
|
+
// setConfigs(json)
|
|
17
|
+
// })
|
|
18
|
+
// .catch(error => console.error(error));
|
|
19
|
+
// })();
|
|
20
|
+
// }, []);
|
|
21
|
+
// const [bigBoard, setBigBoard] = useState<Record<string, ISummary>>({});
|
|
22
|
+
// useEffect(() => {
|
|
23
|
+
// (async () => {
|
|
24
|
+
// fetch('/kokomoBay/docs/summary.json')
|
|
25
|
+
// .then(response => response.json())
|
|
26
|
+
// .then(json => {
|
|
27
|
+
// setBigBoard(json)
|
|
28
|
+
// })
|
|
29
|
+
// .catch(error => console.error(error));
|
|
30
|
+
// })();
|
|
31
|
+
// }, []);
|
|
32
|
+
const [summary, setSummary] = useState();
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
(async () => {
|
|
35
|
+
const x = projects.map(async (p) => {
|
|
36
|
+
return [
|
|
37
|
+
p,
|
|
38
|
+
(await (await fetch(`/kokomoBay/testeranto/reports/${p}/config.json`)).json()),
|
|
39
|
+
(await (await fetch(`/kokomoBay/testeranto/reports/${p}/summary.json`)).json())
|
|
40
|
+
];
|
|
41
|
+
});
|
|
42
|
+
Promise.all(x).then((v) => {
|
|
43
|
+
setSummary(v);
|
|
44
|
+
});
|
|
45
|
+
// fetch('/kokomoBay/docs/summary.json')
|
|
46
|
+
// .then(response => response.json())
|
|
47
|
+
// .then(json => {
|
|
48
|
+
// setBigBoard(json)
|
|
49
|
+
// })
|
|
50
|
+
// .catch(error => console.error(error));
|
|
51
|
+
})();
|
|
52
|
+
}, []);
|
|
53
|
+
if (!summary || (summary === null || summary === void 0 ? void 0 : summary.length) === 0) {
|
|
54
|
+
return React.createElement("div", null, "loading...");
|
|
55
|
+
}
|
|
56
|
+
console.log("summary", summary);
|
|
57
|
+
// const collated: ICollations = configs.tests.map((c) => {
|
|
58
|
+
// return {
|
|
59
|
+
// ...bigBoard[c[0]],
|
|
60
|
+
// name: c[0],
|
|
61
|
+
// runTime: c[1],
|
|
62
|
+
// tr: c[2],
|
|
63
|
+
// sidecars: c[3],
|
|
64
|
+
// staticAnalysis: bigBoard[c[0]].staticErrors,
|
|
65
|
+
// typeErrors: bigBoard[c[0]].typeErrors,
|
|
66
|
+
// bddErrors: bigBoard[c[0]].runTimeError,
|
|
67
|
+
// prompt: bigBoard[c[0]].prompt
|
|
68
|
+
// } as ICollation
|
|
69
|
+
// });
|
|
70
|
+
function copyToClipboard(text) {
|
|
71
|
+
navigator.clipboard.writeText(text)
|
|
72
|
+
.then(() => {
|
|
73
|
+
console.log('Text copied to clipboard');
|
|
74
|
+
})
|
|
75
|
+
.catch(err => {
|
|
76
|
+
console.error('Error copying text: ', err);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return React.createElement("div", null,
|
|
80
|
+
React.createElement(Table, { striped: true, bordered: true, hover: true },
|
|
81
|
+
React.createElement("thead", null,
|
|
82
|
+
React.createElement("tr", null,
|
|
83
|
+
React.createElement("th", null, "project"),
|
|
84
|
+
React.createElement("th", null, "platform"),
|
|
85
|
+
React.createElement("th", null, "BDD errors"),
|
|
86
|
+
React.createElement("th", null, "Lint errors"),
|
|
87
|
+
React.createElement("th", null, "Type errors"),
|
|
88
|
+
React.createElement("th", null, "prompt"))),
|
|
89
|
+
React.createElement("tbody", null, ...summary.map((s) => {
|
|
90
|
+
return React.createElement(React.Fragment, null,
|
|
91
|
+
React.createElement("tr", null,
|
|
92
|
+
React.createElement("th", null, s[0])),
|
|
93
|
+
...s[1].tests.map((t) => {
|
|
94
|
+
const x = `${s[0]}/${t[0].split(".").slice(0, -1).join(".")}/${t[1]}`;
|
|
95
|
+
const y = s[2][t[0]];
|
|
96
|
+
return React.createElement("tr", null,
|
|
97
|
+
React.createElement("td", null, t[0]),
|
|
98
|
+
React.createElement("td", null, t[1]),
|
|
99
|
+
React.createElement("td", null,
|
|
100
|
+
React.createElement("a", { href: `/kokomoBay/testeranto/reports/${x}/littleBoard.html` }, y.runTimeError)),
|
|
101
|
+
React.createElement("td", null,
|
|
102
|
+
React.createElement("a", { href: `/kokomoBay/testeranto/reports/${x}/lint_errors.html` }, y.staticErrors)),
|
|
103
|
+
React.createElement("td", null,
|
|
104
|
+
React.createElement("a", { href: `/kokomoBay/testeranto/reports/${x}/type_errors.txt` }, y.typeErrors)),
|
|
105
|
+
React.createElement("td", null,
|
|
106
|
+
React.createElement("pre", null, s[2][t[0]].prompt)));
|
|
107
|
+
}));
|
|
108
|
+
}))),
|
|
109
|
+
React.createElement(Footer, null));
|
|
110
|
+
};
|
|
111
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
112
|
+
const elem = document.getElementById("root");
|
|
113
|
+
if (elem) {
|
|
114
|
+
ReactDom.createRoot(elem).render(React.createElement(BigBoard, {}, []));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
console.log("hello BigBoard!");
|
|
@@ -9,7 +9,7 @@ const StepPane = ({ step }) => {
|
|
|
9
9
|
React.createElement("pre", null,
|
|
10
10
|
React.createElement("code", null, JSON.stringify(step, null, 2))));
|
|
11
11
|
};
|
|
12
|
-
const TestPane = ({ given }) => {
|
|
12
|
+
const TestPane = ({ given, log }) => {
|
|
13
13
|
return React.createElement("div", null,
|
|
14
14
|
" ",
|
|
15
15
|
React.createElement(Tab.Container, { id: "TestPane-tabs", defaultActiveKey: "first" },
|
|
@@ -29,7 +29,7 @@ const TestPane = ({ given }) => {
|
|
|
29
29
|
" ",
|
|
30
30
|
t.error && "!")),
|
|
31
31
|
React.createElement(Nav.Link, { eventKey: `bdd-errors` }, "errors")))),
|
|
32
|
-
React.createElement(Col, { sm:
|
|
32
|
+
React.createElement(Col, { sm: 6 },
|
|
33
33
|
React.createElement(Tab.Content, null,
|
|
34
34
|
React.createElement(Tab.Pane, { eventKey: `bdd-features` },
|
|
35
35
|
React.createElement("pre", null,
|
|
@@ -60,7 +60,13 @@ const BddPage = () => {
|
|
|
60
60
|
setBddErrors(await (await fetch(`tests.json`)).json());
|
|
61
61
|
})();
|
|
62
62
|
}, [configs]);
|
|
63
|
-
|
|
63
|
+
const [log, setLog] = useState();
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
(async () => {
|
|
66
|
+
setLog(await (await fetch(`log.txt`)).text());
|
|
67
|
+
})();
|
|
68
|
+
}, [configs]);
|
|
69
|
+
if (!configs || !bddErrors || !log) {
|
|
64
70
|
return React.createElement("div", null, "loading...");
|
|
65
71
|
}
|
|
66
72
|
return React.createElement("div", null,
|
|
@@ -71,13 +77,16 @@ const BddPage = () => {
|
|
|
71
77
|
React.createElement(Row, null,
|
|
72
78
|
React.createElement(Tab.Container, { id: "root-tab-container", defaultActiveKey: "first" },
|
|
73
79
|
React.createElement(Row, null,
|
|
80
|
+
React.createElement(Col, { sm: 3 },
|
|
81
|
+
React.createElement("pre", null,
|
|
82
|
+
React.createElement("code", null, log))),
|
|
74
83
|
React.createElement(Col, { sm: 3 },
|
|
75
84
|
React.createElement(Nav, { variant: "pills", className: "flex-column" }, ...bddErrors.givens.map((g) => React.createElement(Nav.Item, null,
|
|
76
85
|
React.createElement(Nav.Link, { eventKey: g.key },
|
|
77
86
|
g.key,
|
|
78
87
|
": Given ",
|
|
79
88
|
g.name))))),
|
|
80
|
-
React.createElement(Col, { sm:
|
|
89
|
+
React.createElement(Col, { sm: 6 },
|
|
81
90
|
React.createElement(Tab.Content, null, ...bddErrors.givens.map((g) => React.createElement(Tab.Pane, { eventKey: g.key },
|
|
82
91
|
React.createElement(TestPane, { given: g })))))))),
|
|
83
92
|
React.createElement(Footer, null));
|
package/dist/module/build.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ansiC from "ansi-colors";
|
|
1
2
|
import fs from "fs";
|
|
2
3
|
import path from "path";
|
|
3
4
|
import readline from "readline";
|
|
@@ -9,25 +10,21 @@ import webHtmlFrame from "./web.html.js";
|
|
|
9
10
|
readline.emitKeypressEvents(process.stdin);
|
|
10
11
|
if (process.stdin.isTTY)
|
|
11
12
|
process.stdin.setRawMode(true);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, payload);
|
|
28
|
-
};
|
|
29
|
-
import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
30
|
-
const rawConfig = module.default;
|
|
13
|
+
let testName = process.argv[2];
|
|
14
|
+
let mode = process.argv[3];
|
|
15
|
+
if (mode !== "once" && mode !== "dev") {
|
|
16
|
+
console.error(`The 4th argument should be 'dev' or 'once', not '${mode}'.`);
|
|
17
|
+
process.exit(-1);
|
|
18
|
+
}
|
|
19
|
+
console.log("testeranto is building", testName, mode);
|
|
20
|
+
import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
|
|
21
|
+
const bigConfig = module.default;
|
|
22
|
+
const project = bigConfig.projects[testName];
|
|
23
|
+
if (!project) {
|
|
24
|
+
console.error("no project found for", testName, "in testeranto.config.ts");
|
|
25
|
+
process.exit(-1);
|
|
26
|
+
}
|
|
27
|
+
const rawConfig = bigConfig.projects[testName];
|
|
31
28
|
const getSecondaryEndpointsPoints = (runtime) => {
|
|
32
29
|
const meta = (ts, st) => {
|
|
33
30
|
ts.forEach((t) => {
|
|
@@ -42,13 +39,25 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
42
39
|
};
|
|
43
40
|
return Array.from(meta(config.tests, new Set()));
|
|
44
41
|
};
|
|
45
|
-
const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/" +
|
|
42
|
+
const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/testeranto/bundles/" + testName });
|
|
43
|
+
console.log(`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`);
|
|
44
|
+
process.stdin.on("keypress", (str, key) => {
|
|
45
|
+
if (key.name === "q") {
|
|
46
|
+
console.log("Testeranto-Build is shutting down...");
|
|
47
|
+
mode = "once";
|
|
48
|
+
onDone();
|
|
49
|
+
}
|
|
50
|
+
else if (key.name === "x") {
|
|
51
|
+
console.log("Testeranto-Build is shutting down forcefully...");
|
|
52
|
+
process.exit(-1);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.log(`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
46
58
|
let nodeDone = false;
|
|
47
59
|
let webDone = false;
|
|
48
|
-
let mode = config.devMode ? "DEV" : "PROD";
|
|
49
60
|
let status = "build";
|
|
50
|
-
// let pm: PM_Main | undefined = new PM_Main(config);
|
|
51
|
-
// const fileHashes = {};
|
|
52
61
|
const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
|
|
53
62
|
const onNodeDone = () => {
|
|
54
63
|
nodeDone = true;
|
|
@@ -62,72 +71,67 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
62
71
|
if (nodeDone && webDone) {
|
|
63
72
|
status = "built";
|
|
64
73
|
}
|
|
65
|
-
if (nodeDone && webDone &&
|
|
66
|
-
|
|
67
|
-
// console.log("watching", outputFile);
|
|
68
|
-
// try {
|
|
69
|
-
// watch(outputFile, async (filename) => {
|
|
70
|
-
// const hash = await fileHash(outputFile);
|
|
71
|
-
// if (fileHashes[k] !== hash) {
|
|
72
|
-
// fileHashes[k] = hash;
|
|
73
|
-
// console.log(`< ${filename} `);
|
|
74
|
-
// pm.launchNode(k, outputFile);
|
|
75
|
-
// }
|
|
76
|
-
// });
|
|
77
|
-
// } catch (e) {
|
|
78
|
-
// console.error(e);
|
|
79
|
-
// }
|
|
80
|
-
// });
|
|
81
|
-
// Object.entries(webEntryPoints).forEach(([k, outputFile]) => {
|
|
82
|
-
// console.log("watching", outputFile);
|
|
83
|
-
// watch(outputFile, async (filename) => {
|
|
84
|
-
// const hash = await fileHash(outputFile);
|
|
85
|
-
// console.log(`< ${filename} ${hash}`);
|
|
86
|
-
// if (fileHashes[k] !== hash) {
|
|
87
|
-
// fileHashes[k] = hash;
|
|
88
|
-
// pm.launchWeb(k, outputFile);
|
|
89
|
-
// }
|
|
90
|
-
// });
|
|
91
|
-
// });
|
|
92
|
-
}
|
|
93
|
-
if (nodeDone && webDone && mode === "PROD") {
|
|
94
|
-
console.log("Testeranto-EsBuild is all done. Goodbye!");
|
|
74
|
+
if (nodeDone && webDone && mode === "once") {
|
|
75
|
+
console.log(ansiC.inverse(`${testName} has been built. Goodbye.`));
|
|
95
76
|
process.exit();
|
|
96
77
|
}
|
|
97
|
-
else {
|
|
98
|
-
if (mode === "PROD") {
|
|
99
|
-
console.log("waiting for tests to finish");
|
|
100
|
-
console.log(JSON.stringify({
|
|
101
|
-
nodeDone: nodeDone,
|
|
102
|
-
webDone: webDone,
|
|
103
|
-
mode: mode,
|
|
104
|
-
}, null, 2));
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
console.log("waiting for tests to change");
|
|
108
|
-
}
|
|
109
|
-
if (config.devMode) {
|
|
110
|
-
console.log("ready and watching for changes...");
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
// pm.shutDown();
|
|
114
|
-
}
|
|
115
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
116
|
-
}
|
|
117
78
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
79
|
+
if (!fs.existsSync(`testeranto/reports/${testName}`)) {
|
|
80
|
+
fs.mkdirSync(`testeranto/reports/${testName}`);
|
|
81
|
+
}
|
|
82
|
+
fs.writeFileSync(`${process.cwd()}/testeranto/reports/${testName}/index.html`, `
|
|
83
|
+
<!DOCTYPE html>
|
|
84
|
+
<html lang="en">
|
|
85
|
+
|
|
86
|
+
<head>
|
|
87
|
+
<meta name="description" content="Webpage description goes here" />
|
|
88
|
+
<meta charset="utf-8" />
|
|
89
|
+
<title>kokomoBay - testeranto</title>
|
|
90
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
91
|
+
<meta name="author" content="" />
|
|
92
|
+
|
|
93
|
+
<link rel="stylesheet" href="/kokomoBay/testeranto/ReportClient.css" />
|
|
94
|
+
<script type="module" src="/kokomoBay/testeranto/ReportClient.js"></script>
|
|
95
|
+
|
|
96
|
+
</head>
|
|
97
|
+
|
|
98
|
+
<body>
|
|
99
|
+
<div id="root">
|
|
100
|
+
react is loading
|
|
101
|
+
</div>
|
|
102
|
+
</body>
|
|
103
|
+
|
|
104
|
+
</html>
|
|
105
|
+
`);
|
|
106
|
+
fs.writeFileSync(`testeranto/reports/${testName}/config.json`, JSON.stringify(config, null, 2));
|
|
107
|
+
fs.writeFileSync(`${process.cwd()}/testeranto/index.html`, `
|
|
108
|
+
<!DOCTYPE html>
|
|
109
|
+
<html lang="en">
|
|
110
|
+
|
|
111
|
+
<head>
|
|
112
|
+
<meta name="description" content="Webpage description goes here" />
|
|
113
|
+
<meta charset="utf-8" />
|
|
114
|
+
<title>kokomoBay - testeranto</title>
|
|
115
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
116
|
+
<meta name="author" content="" />
|
|
117
|
+
|
|
118
|
+
<script type="application/json" id="bigConfig">
|
|
119
|
+
${JSON.stringify(Object.keys(bigConfig.projects))}
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<link rel="stylesheet" href="/kokomoBay/testeranto/Project.css" />
|
|
123
|
+
<script type="module" src="/kokomoBay/testeranto/Project.js"></script>
|
|
124
|
+
|
|
125
|
+
</head>
|
|
126
|
+
|
|
127
|
+
<body>
|
|
128
|
+
<div id="root">
|
|
129
|
+
react is loading
|
|
130
|
+
</div>
|
|
131
|
+
</body>
|
|
132
|
+
|
|
133
|
+
</html>
|
|
134
|
+
`);
|
|
131
135
|
Promise.resolve(Promise.all([...getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
|
|
132
136
|
const sourceFileSplit = sourceFilePath.split("/");
|
|
133
137
|
const sourceDir = sourceFileSplit.slice(0, -1);
|
|
@@ -136,13 +140,13 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
136
140
|
.split(".")
|
|
137
141
|
.slice(0, -1)
|
|
138
142
|
.join(".");
|
|
139
|
-
const htmlFilePath = path.normalize(`${process.cwd()}/${
|
|
143
|
+
const htmlFilePath = path.normalize(`${process.cwd()}/testeranto/bundles/web/${testName}/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
|
|
140
144
|
const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
|
|
141
145
|
return fs.promises
|
|
142
146
|
.mkdir(path.dirname(htmlFilePath), { recursive: true })
|
|
143
147
|
.then((x) => fs.writeFileSync(htmlFilePath, webHtmlFrame(jsfilePath, htmlFilePath)));
|
|
144
148
|
})));
|
|
145
|
-
glob(
|
|
149
|
+
glob(`${process.cwd()}/testeranto/bundles/${testName}/chunk-*.mjs`, {
|
|
146
150
|
ignore: "node_modules/**",
|
|
147
151
|
}).then((chunks) => {
|
|
148
152
|
chunks.forEach((chunk) => {
|
|
@@ -151,9 +155,9 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
151
155
|
});
|
|
152
156
|
await Promise.all([
|
|
153
157
|
esbuild
|
|
154
|
-
.context(esbuildNodeConfiger(config, Object.keys(nodeEntryPoints)))
|
|
158
|
+
.context(esbuildNodeConfiger(config, Object.keys(nodeEntryPoints), testName))
|
|
155
159
|
.then(async (nodeContext) => {
|
|
156
|
-
if (
|
|
160
|
+
if (mode === "dev") {
|
|
157
161
|
await nodeContext.watch().then((v) => {
|
|
158
162
|
onNodeDone();
|
|
159
163
|
});
|
|
@@ -166,9 +170,9 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
166
170
|
return nodeContext;
|
|
167
171
|
}),
|
|
168
172
|
esbuild
|
|
169
|
-
.context(esbuildWebConfiger(config, Object.keys(webEntryPoints)))
|
|
173
|
+
.context(esbuildWebConfiger(config, Object.keys(webEntryPoints), testName))
|
|
170
174
|
.then(async (webContext) => {
|
|
171
|
-
if (
|
|
175
|
+
if (mode === "dev") {
|
|
172
176
|
await webContext.watch().then((v) => {
|
|
173
177
|
onWebDone();
|
|
174
178
|
});
|
|
@@ -182,3 +186,20 @@ import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
|
182
186
|
}),
|
|
183
187
|
]);
|
|
184
188
|
});
|
|
189
|
+
const getRunnables = (tests, payload = {
|
|
190
|
+
nodeEntryPoints: {},
|
|
191
|
+
webEntryPoints: {},
|
|
192
|
+
}) => {
|
|
193
|
+
return tests.reduce((pt, cv, cndx, cry) => {
|
|
194
|
+
if (cv[1] === "node") {
|
|
195
|
+
pt.nodeEntryPoints[cv[0]] = path.resolve(`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
|
|
196
|
+
}
|
|
197
|
+
else if (cv[1] === "web") {
|
|
198
|
+
pt.webEntryPoints[cv[0]] = path.resolve(`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
|
|
199
|
+
}
|
|
200
|
+
if (cv[3].length) {
|
|
201
|
+
getRunnables(cv[3], payload);
|
|
202
|
+
}
|
|
203
|
+
return pt;
|
|
204
|
+
}, payload);
|
|
205
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const config = {
|
|
2
2
|
src: "src",
|
|
3
|
-
outdir: "docs",
|
|
3
|
+
// outdir: "docs",
|
|
4
4
|
tests: [],
|
|
5
5
|
debugger: true,
|
|
6
6
|
clearScreen: false,
|
|
7
7
|
devMode: true,
|
|
8
8
|
minify: false,
|
|
9
|
-
outbase: ".",
|
|
9
|
+
// outbase: ".",
|
|
10
10
|
ports: ["3001"],
|
|
11
11
|
externals: [],
|
|
12
12
|
nodePlugins: [],
|
|
@@ -6,15 +6,19 @@ const register = (entrypoint, sources) => {
|
|
|
6
6
|
}
|
|
7
7
|
sources.forEach((s) => otherInputs[entrypoint].add(s));
|
|
8
8
|
};
|
|
9
|
-
export default (platform,
|
|
9
|
+
export default (platform, testName) => {
|
|
10
|
+
const d = `testeranto/bundles/${platform}/${testName}/`;
|
|
11
|
+
const f = `testeranto/bundles/${platform}/${testName}/metafile.json`;
|
|
12
|
+
if (!fs.existsSync(d)) {
|
|
13
|
+
fs.mkdirSync(d);
|
|
14
|
+
}
|
|
10
15
|
return {
|
|
11
16
|
register,
|
|
12
17
|
inputFilesPluginFactory: {
|
|
13
18
|
name: "metafileWriter",
|
|
14
19
|
setup(build) {
|
|
15
20
|
build.onEnd((result) => {
|
|
16
|
-
|
|
17
|
-
fs.writeFileSync(`docs/${platform}/metafile.json`, JSON.stringify(result, null, 2));
|
|
21
|
+
fs.writeFileSync(f, JSON.stringify(result, null, 2));
|
|
18
22
|
});
|
|
19
23
|
},
|
|
20
24
|
},
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import baseEsBuildConfig from "./index.js";
|
|
2
2
|
import inputFilesPlugin from "./inputFilesPlugin.js";
|
|
3
3
|
import featuresPlugin from "./featuresPlugin";
|
|
4
|
-
export default (config, entryPoints) => {
|
|
5
|
-
const { inputFilesPluginFactory, register } = inputFilesPlugin("node",
|
|
6
|
-
|
|
4
|
+
export default (config, entryPoints, testName) => {
|
|
5
|
+
const { inputFilesPluginFactory, register } = inputFilesPlugin("node",
|
|
6
|
+
// entryPoints,
|
|
7
|
+
testName);
|
|
8
|
+
return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { splitting: true, outdir: `testeranto/bundles/node/${testName}/`,
|
|
7
9
|
// inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
|
|
8
10
|
metafile: true, supported: {
|
|
9
11
|
"dynamic-import": true,
|
|
@@ -2,9 +2,9 @@ import path from "path";
|
|
|
2
2
|
import baseEsBuildConfig from "./index.js";
|
|
3
3
|
import inputFilesPlugin from "./inputFilesPlugin.js";
|
|
4
4
|
import featuresPlugin from "./featuresPlugin.js";
|
|
5
|
-
export default (config, entryPoints) => {
|
|
6
|
-
const { inputFilesPluginFactory, register } = inputFilesPlugin("web",
|
|
7
|
-
return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { outdir:
|
|
5
|
+
export default (config, entryPoints, testName) => {
|
|
6
|
+
const { inputFilesPluginFactory, register } = inputFilesPlugin("web", testName);
|
|
7
|
+
return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { outdir: `testeranto/bundles/web/${testName}`, alias: {
|
|
8
8
|
react: path.resolve("./node_modules/react"),
|
|
9
9
|
}, metafile: true, external: [
|
|
10
10
|
"path",
|
package/dist/module/init-docs.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
1
|
import Init from "./Init";
|
|
3
2
|
console.log("Initializing a testeranto project");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
fs.writeFileSync("testeranto.mts", fs.readFileSync("node_modules/testeranto/src/defaultConfig.ts"));
|
|
7
|
-
import(process.cwd() + "/" + "testeranto.mts").then((module) => {
|
|
8
|
-
Init(module.default);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
import(process.cwd() + "/" + process.argv[2]).then((module) => {
|
|
13
|
-
Init(module.default);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
3
|
+
Init();
|
|
4
|
+
console.log("testeranto project initialized");
|