testeranto 0.111.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/Init.js +68 -0
- package/dist/common/Node.js +27 -0
- package/dist/common/PM/index.js +7 -0
- package/dist/common/PM/main.js +1176 -0
- package/dist/common/PM/node.js +128 -0
- package/dist/common/PM/web.js +121 -0
- package/dist/common/ReportServer.js +22 -0
- package/dist/common/SubPackages/react/component/node.js +19 -0
- package/dist/common/SubPackages/react/component/web.js +19 -0
- package/dist/common/SubPackages/react/jsx/index.js +21 -0
- package/dist/common/SubPackages/react/jsx/node.js +10 -0
- package/dist/common/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/SubPackages/react-dom/component/node.js +88 -0
- package/dist/common/SubPackages/react-dom/component/web.js +67 -0
- package/dist/common/SubPackages/react-dom/jsx/index.js +2 -0
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/SubPackages/react-dom/jsx/web.js +128 -0
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +54 -0
- package/dist/common/SubPackages/react-test-renderer/component/index.js +2 -0
- package/dist/common/SubPackages/react-test-renderer/component/interface.js +70 -0
- package/dist/common/SubPackages/react-test-renderer/component/node.js +8 -0
- package/dist/common/SubPackages/react-test-renderer/component/web.js +8 -0
- package/dist/common/SubPackages/react-test-renderer/fc/node.js +60 -0
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +60 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +67 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/node.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +52 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +10 -0
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +49 -0
- package/dist/common/build.js +222 -0
- package/dist/common/defaultConfig.js +20 -0
- package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +6 -0
- package/dist/common/esbuildConfigs/featuresPlugin.js +39 -0
- package/dist/common/esbuildConfigs/index.js +21 -0
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +27 -0
- package/dist/common/esbuildConfigs/node.js +37 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/init-docs.js +53 -0
- package/dist/common/lib/abstractBase.js +329 -0
- package/dist/common/lib/basebuilder.js +98 -0
- package/dist/common/lib/classBuilder.js +40 -0
- package/dist/common/lib/core.js +117 -0
- package/dist/common/lib/index.js +21 -0
- package/dist/common/lib/types.js +2 -0
- package/dist/common/package.json +3 -0
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/run.js +62 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -0
- package/dist/common/utils.js +43 -0
- package/dist/common/web.html.js +22 -0
- package/dist/module/Footer.js +4 -0
- package/dist/module/Init.js +63 -0
- package/dist/module/Node.js +20 -0
- package/dist/module/PM/index.js +3 -0
- package/dist/module/PM/main.js +1136 -0
- package/dist/module/PM/node.js +121 -0
- package/dist/module/PM/web.js +117 -0
- package/dist/module/ReportClient.js +97 -0
- package/dist/module/ReportServer.js +17 -0
- package/dist/module/SubPackages/react/component/node.js +14 -0
- package/dist/module/SubPackages/react/component/web.js +14 -0
- package/dist/module/SubPackages/react/jsx/index.js +15 -0
- package/dist/module/SubPackages/react/jsx/node.js +5 -0
- package/dist/module/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/SubPackages/react-dom/component/node.js +80 -0
- package/dist/module/SubPackages/react-dom/component/web.js +62 -0
- package/dist/module/SubPackages/react-dom/jsx/index.js +1 -0
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/SubPackages/react-dom/jsx/web.js +90 -0
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +16 -0
- package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -0
- package/dist/module/SubPackages/react-test-renderer/component/interface.js +31 -0
- package/dist/module/SubPackages/react-test-renderer/component/node.js +3 -0
- package/dist/module/SubPackages/react-test-renderer/component/web.js +3 -0
- package/dist/module/SubPackages/react-test-renderer/fc/node.js +22 -0
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +22 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +28 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +16 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +5 -0
- package/dist/module/TestReport.js +91 -0
- package/dist/module/Types.js +1 -0
- package/dist/module/Web.js +42 -0
- package/dist/module/build.js +184 -0
- package/dist/module/defaultConfig.js +18 -0
- package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +3 -0
- package/dist/module/esbuildConfigs/featuresPlugin.js +34 -0
- package/dist/module/esbuildConfigs/index.js +19 -0
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +22 -0
- package/dist/module/esbuildConfigs/node.js +32 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/init-docs.js +15 -0
- package/dist/module/lib/abstractBase.js +321 -0
- package/dist/module/lib/basebuilder.js +94 -0
- package/dist/module/lib/classBuilder.js +36 -0
- package/dist/module/lib/core.js +114 -0
- package/dist/module/lib/index.js +17 -0
- package/dist/module/lib/types.js +1 -0
- package/dist/module/package.json +3 -0
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/run.js +24 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -0
- package/dist/module/utils.js +29 -0
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/ReportClient.css +11367 -0
- package/dist/prebuild/ReportClient.js +24641 -0
- package/dist/prebuild/ReportServer.mjs +16 -0
- package/dist/prebuild/TestReport.css +11367 -0
- package/dist/prebuild/TestReport.js +27484 -0
- package/dist/prebuild/build.mjs +376 -0
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +9 -0
- package/dist/prebuild/init-docs.mjs +104 -0
- package/dist/prebuild/run.mjs +1153 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/Init.d.ts +2 -0
- package/dist/types/Node.d.ts +12 -0
- package/dist/types/PM/index.d.ts +34 -0
- package/dist/types/PM/main.d.ts +66 -0
- package/dist/types/PM/node.d.ts +40 -0
- package/dist/types/PM/web.d.ts +38 -0
- package/dist/types/ReportServer.d.ts +1 -0
- package/dist/types/SubPackages/react/component/node.d.ts +7 -0
- package/dist/types/SubPackages/react/component/web.d.ts +7 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +12 -0
- package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/SubPackages/react-dom/component/node.d.ts +11 -0
- package/dist/types/SubPackages/react-dom/component/web.d.ts +20 -0
- package/dist/types/SubPackages/react-dom/jsx/index.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +7 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +6 -0
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +13 -0
- package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +16 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +15 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
- package/dist/types/Types.d.ts +61 -0
- package/dist/types/Web.d.ts +9 -0
- package/dist/types/build.d.ts +1 -0
- package/dist/types/defaultConfig.d.ts +3 -0
- package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +2 -0
- package/dist/types/esbuildConfigs/featuresPlugin.d.ts +5 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +6 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/init-docs.d.ts +1 -0
- package/dist/types/lib/abstractBase.d.ts +110 -0
- package/dist/types/lib/basebuilder.d.ts +27 -0
- package/dist/types/lib/classBuilder.d.ts +7 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +83 -0
- package/dist/types/lib/types.d.ts +14 -0
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/run.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/utils.d.ts +15 -0
- package/dist/types/web.html.d.ts +2 -0
- package/package.json +1 -1
- package/src/PM/main.ts +25 -57
- package/src/ReportClient.tsx +43 -41
- package/src/run.ts +8 -5
- package/src/utils.ts +10 -0
- package/tsc.log +8 -8
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import ReactDom from "react-dom";
|
|
4
|
+
import Testeranto from "../../../Web.js";
|
|
5
|
+
const TesterantoComponent = ({ done, innerComp, }) => {
|
|
6
|
+
const myContainer = useRef(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
console.log("useEffect called!", myContainer.current);
|
|
9
|
+
done(myContainer.current);
|
|
10
|
+
}, []);
|
|
11
|
+
return React.createElement("div", { ref: myContainer }, innerComp());
|
|
12
|
+
};
|
|
13
|
+
export default (testImplementations, testSpecifications, testInput) => {
|
|
14
|
+
const t = Testeranto(testInput, testSpecifications, testImplementations, {
|
|
15
|
+
beforeAll: async (reactElement, itr) => {
|
|
16
|
+
return await new Promise((resolve, rej) => {
|
|
17
|
+
const htmlElement = document.getElementById("root");
|
|
18
|
+
if (htmlElement) {
|
|
19
|
+
const domRoot = ReactDom.createRoot(htmlElement);
|
|
20
|
+
domRoot.render(createElement(TesterantoComponent, {
|
|
21
|
+
// ...initialProps,
|
|
22
|
+
innerComp: reactElement,
|
|
23
|
+
done: (reactElement) => {
|
|
24
|
+
resolve({
|
|
25
|
+
htmlElement,
|
|
26
|
+
reactElement,
|
|
27
|
+
domRoot,
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
}, []));
|
|
31
|
+
// resolve({ htmlElement });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
beforeEach: async (subject) => {
|
|
36
|
+
return subject;
|
|
37
|
+
// return new Promise((resolve, rej) => {
|
|
38
|
+
// resolve(subject);
|
|
39
|
+
// // const tc = TesterantoComponent({
|
|
40
|
+
// // innerComp: () =>
|
|
41
|
+
// // testInput({
|
|
42
|
+
// // port: 3003,
|
|
43
|
+
// // address: "some-address",
|
|
44
|
+
// // secretKey: "someSecretKey",
|
|
45
|
+
// // abi: "foo",
|
|
46
|
+
// // }),
|
|
47
|
+
// // done: (reactElement: any) => {
|
|
48
|
+
// // console.log("mark9");
|
|
49
|
+
// // resolve(reactElement);
|
|
50
|
+
// // // process.nextTick(() => {
|
|
51
|
+
// // // resolve(reactElement);
|
|
52
|
+
// // // });
|
|
53
|
+
// // },
|
|
54
|
+
// // });
|
|
55
|
+
// // console.log("mark9", tc);
|
|
56
|
+
// // createPortal(tc, subject.domRoot);
|
|
57
|
+
// });
|
|
58
|
+
},
|
|
59
|
+
andWhen: async function (s, whenCB, tr, utils) {
|
|
60
|
+
return whenCB(s, utils);
|
|
61
|
+
// return new Promise(async (resolve, rej) => {
|
|
62
|
+
// // resolve(await whenCB(s, utils));
|
|
63
|
+
// // process.nextTick(() => {
|
|
64
|
+
// // resolve(whenCB()(s));
|
|
65
|
+
// // });
|
|
66
|
+
// });
|
|
67
|
+
},
|
|
68
|
+
butThen: async function (s, thenCB, tr, utils) {
|
|
69
|
+
return new Promise((resolve, rej) => {
|
|
70
|
+
resolve(thenCB(s, utils));
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
afterEach: async function (store, ndx, artificer) {
|
|
74
|
+
return new Promise((resolve, rej) => {
|
|
75
|
+
resolve({});
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
afterAll: (store, artificer) => {
|
|
79
|
+
return new Promise((resolve, rej) => {
|
|
80
|
+
resolve({});
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
85
|
+
const rootElement = document.getElementById("root");
|
|
86
|
+
if (rootElement) {
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return t;
|
|
90
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
import test from "../../../Node";
|
|
4
|
+
export default (testImplementations, testSpecifications, testInput) => test(testInput, testSpecifications, testImplementations, {
|
|
5
|
+
beforeEach: function (CComponent, props) {
|
|
6
|
+
let component;
|
|
7
|
+
act(() => {
|
|
8
|
+
component = renderer.create(React.createElement(CComponent, props, []));
|
|
9
|
+
});
|
|
10
|
+
return component;
|
|
11
|
+
},
|
|
12
|
+
andWhen: async function (renderer, whenCB) {
|
|
13
|
+
await act(() => whenCB()(renderer));
|
|
14
|
+
return renderer;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
export const testInterface = {
|
|
4
|
+
beforeEach: function (CComponent, propsAndChildren) {
|
|
5
|
+
function Link(proper) {
|
|
6
|
+
return React.createElement(CComponent, proper(), []);
|
|
7
|
+
}
|
|
8
|
+
return new Promise((res, rej) => {
|
|
9
|
+
act(async () => {
|
|
10
|
+
const testRenderer = await renderer.create(Link(propsAndChildren));
|
|
11
|
+
res(testRenderer);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
andWhen: async function (renderer, whenCB) {
|
|
16
|
+
await act(() => whenCB(renderer));
|
|
17
|
+
return renderer;
|
|
18
|
+
},
|
|
19
|
+
// andWhen: function (s: Store, whenCB): Promise<Selection> {
|
|
20
|
+
// return whenCB()(s);
|
|
21
|
+
// },
|
|
22
|
+
butThen: async function (s, thenCB, tr) {
|
|
23
|
+
return thenCB(s);
|
|
24
|
+
},
|
|
25
|
+
afterEach: async function (store, ndx, artificer) {
|
|
26
|
+
return {};
|
|
27
|
+
},
|
|
28
|
+
afterAll: (store, artificer) => {
|
|
29
|
+
return;
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
import test from "../../../Node.js";
|
|
4
|
+
export default (testImplementations, testSpecifications, testInput) => test(testInput, testSpecifications, testImplementations, {
|
|
5
|
+
beforeEach: function (CComponent, props) {
|
|
6
|
+
return new Promise((res, rej) => {
|
|
7
|
+
let component;
|
|
8
|
+
act(() => {
|
|
9
|
+
component = renderer.create(React.createElement(CComponent, props, []));
|
|
10
|
+
res(component);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
andWhen: async function (renderer, whenCB) {
|
|
15
|
+
await act(() => whenCB()(renderer));
|
|
16
|
+
return renderer;
|
|
17
|
+
},
|
|
18
|
+
afterEach: async (store, key, artificer) => {
|
|
19
|
+
console.log("afterall");
|
|
20
|
+
store.unmount();
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
import test from "../../../Web.js";
|
|
4
|
+
export default (testImplementations, testSpecifications, testInput) => test(testInput, testSpecifications, testImplementations, {
|
|
5
|
+
beforeEach: function (CComponent, props) {
|
|
6
|
+
return new Promise((res, rej) => {
|
|
7
|
+
let component;
|
|
8
|
+
act(() => {
|
|
9
|
+
component = renderer.create(React.createElement(CComponent, props, []));
|
|
10
|
+
res(component);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
andWhen: async function (renderer, whenCB) {
|
|
15
|
+
await act(() => whenCB()(renderer));
|
|
16
|
+
return renderer;
|
|
17
|
+
},
|
|
18
|
+
afterEach: async (store, key, artificer) => {
|
|
19
|
+
console.log("afterall");
|
|
20
|
+
store.unmount();
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
export const testInterface = {
|
|
4
|
+
butThen: async function (s, thenCB) {
|
|
5
|
+
// console.log("butThen", thenCB.toString());
|
|
6
|
+
return thenCB(s);
|
|
7
|
+
},
|
|
8
|
+
beforeEach: function (CComponent, props) {
|
|
9
|
+
let component;
|
|
10
|
+
act(() => {
|
|
11
|
+
// component = renderer.create(
|
|
12
|
+
// React.createElement(
|
|
13
|
+
// AppContext.Provider,
|
|
14
|
+
// { value: contextValue },
|
|
15
|
+
// React.createElement(AppContext.Consumer, null, (context) =>
|
|
16
|
+
// React.createElement(CComponent, Object.assign({}, context, {}))
|
|
17
|
+
// )
|
|
18
|
+
// )
|
|
19
|
+
// );
|
|
20
|
+
component = renderer.create(React.createElement(CComponent, props, React.createElement(CComponent, props, [])));
|
|
21
|
+
});
|
|
22
|
+
return component;
|
|
23
|
+
},
|
|
24
|
+
andWhen: async function (renderer, whenCB) {
|
|
25
|
+
await act(() => whenCB(renderer));
|
|
26
|
+
return renderer;
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import test from "../../../Node.js";
|
|
2
|
+
import { testInterface } from "./index.js";
|
|
3
|
+
export default (testImplementations, testSpecifications, testInput, testInterface2 = testInterface) => {
|
|
4
|
+
return test(testInput, testSpecifications, testImplementations, testInterface2);
|
|
5
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import test from "../../../Web.js";
|
|
2
|
+
import { testInterface } from "./index.js";
|
|
3
|
+
export default (testImplementations, testSpecifications, testInput, testInterface2 = testInterface) => {
|
|
4
|
+
return test(testInput, testSpecifications, testImplementations, testInterface2);
|
|
5
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import renderer, { act } from "react-test-renderer";
|
|
2
|
+
export const testInterface = {
|
|
3
|
+
beforeEach: async (CComponent) => {
|
|
4
|
+
return new Promise((res, rej) => {
|
|
5
|
+
let component;
|
|
6
|
+
act(async () => {
|
|
7
|
+
component = renderer.create(CComponent);
|
|
8
|
+
});
|
|
9
|
+
res(component);
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
andWhen: async function (renderer, whenCB) {
|
|
13
|
+
await act(() => whenCB()(renderer));
|
|
14
|
+
return renderer;
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import ReactDom from "react-dom/client";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import { Col, Nav, Row, Tab } from "react-bootstrap";
|
|
4
|
+
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
5
|
+
import "./style.css";
|
|
6
|
+
import { Footer } from "./Footer";
|
|
7
|
+
const StepPane = ({ step }) => {
|
|
8
|
+
return React.createElement("div", null,
|
|
9
|
+
React.createElement("pre", null,
|
|
10
|
+
React.createElement("code", null, JSON.stringify(step, null, 2))));
|
|
11
|
+
};
|
|
12
|
+
const TestPane = ({ given }) => {
|
|
13
|
+
return React.createElement("div", null,
|
|
14
|
+
" ",
|
|
15
|
+
React.createElement(Tab.Container, { id: "TestPane-tabs", defaultActiveKey: "first" },
|
|
16
|
+
React.createElement(Row, null,
|
|
17
|
+
React.createElement(Col, { sm: 3 },
|
|
18
|
+
React.createElement(Nav, { variant: "pills", className: "flex-column" },
|
|
19
|
+
React.createElement(Nav.Item, null,
|
|
20
|
+
React.createElement(Nav.Link, { eventKey: `bdd-features` }, "features"),
|
|
21
|
+
...given.whens.map((w, ndx) => React.createElement(Nav.Link, { eventKey: `bdd-when-${ndx}` },
|
|
22
|
+
"When ",
|
|
23
|
+
w.name,
|
|
24
|
+
" ",
|
|
25
|
+
w.error && "!")),
|
|
26
|
+
...given.thens.map((t, ndx) => React.createElement(Nav.Link, { eventKey: `bdd-then-${ndx}` },
|
|
27
|
+
"Then ",
|
|
28
|
+
t.name,
|
|
29
|
+
" ",
|
|
30
|
+
t.error && "!")),
|
|
31
|
+
React.createElement(Nav.Link, { eventKey: `bdd-errors` }, "errors")))),
|
|
32
|
+
React.createElement(Col, { sm: 9 },
|
|
33
|
+
React.createElement(Tab.Content, null,
|
|
34
|
+
React.createElement(Tab.Pane, { eventKey: `bdd-features` },
|
|
35
|
+
React.createElement("pre", null,
|
|
36
|
+
React.createElement("code", null, JSON.stringify(given.features, null, 2)))),
|
|
37
|
+
...given.whens.map((w, ndx) => React.createElement(Tab.Pane, { eventKey: `bdd-when-${ndx}` },
|
|
38
|
+
React.createElement(StepPane, { step: w }))),
|
|
39
|
+
...given.thens.map((t, ndx) => React.createElement(Tab.Pane, { eventKey: `bdd-then-${ndx}` },
|
|
40
|
+
React.createElement(StepPane, { step: t }))),
|
|
41
|
+
React.createElement(Tab.Pane, { eventKey: `bdd-errors` },
|
|
42
|
+
React.createElement("pre", null,
|
|
43
|
+
React.createElement("code", null, JSON.stringify(given.error, null, 2)))))))));
|
|
44
|
+
};
|
|
45
|
+
const BddPage = () => {
|
|
46
|
+
const [configs, setConfigs] = useState();
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
(async () => {
|
|
49
|
+
fetch('/kokomoBay/docs/testeranto.json')
|
|
50
|
+
.then(response => response.json())
|
|
51
|
+
.then(json => {
|
|
52
|
+
setConfigs(json);
|
|
53
|
+
})
|
|
54
|
+
.catch(error => console.error(error));
|
|
55
|
+
})();
|
|
56
|
+
}, []);
|
|
57
|
+
const [bddErrors, setBddErrors] = useState();
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
(async () => {
|
|
60
|
+
setBddErrors(await (await fetch(`tests.json`)).json());
|
|
61
|
+
})();
|
|
62
|
+
}, [configs]);
|
|
63
|
+
if (!configs || !bddErrors) {
|
|
64
|
+
return React.createElement("div", null, "loading...");
|
|
65
|
+
}
|
|
66
|
+
return React.createElement("div", null,
|
|
67
|
+
" ",
|
|
68
|
+
React.createElement(Row, null,
|
|
69
|
+
React.createElement(Col, { sm: 12 },
|
|
70
|
+
React.createElement("h2", null, bddErrors.name))),
|
|
71
|
+
React.createElement(Row, null,
|
|
72
|
+
React.createElement(Tab.Container, { id: "root-tab-container", defaultActiveKey: "first" },
|
|
73
|
+
React.createElement(Row, null,
|
|
74
|
+
React.createElement(Col, { sm: 3 },
|
|
75
|
+
React.createElement(Nav, { variant: "pills", className: "flex-column" }, ...bddErrors.givens.map((g) => React.createElement(Nav.Item, null,
|
|
76
|
+
React.createElement(Nav.Link, { eventKey: g.key },
|
|
77
|
+
g.key,
|
|
78
|
+
": Given ",
|
|
79
|
+
g.name))))),
|
|
80
|
+
React.createElement(Col, { sm: 9 },
|
|
81
|
+
React.createElement(Tab.Content, null, ...bddErrors.givens.map((g) => React.createElement(Tab.Pane, { eventKey: g.key },
|
|
82
|
+
React.createElement(TestPane, { given: g })))))))),
|
|
83
|
+
React.createElement(Footer, null));
|
|
84
|
+
};
|
|
85
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
86
|
+
const elem = document.getElementById("root");
|
|
87
|
+
if (elem) {
|
|
88
|
+
ReactDom.createRoot(elem).render(React.createElement(BddPage, {}, []));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
console.log("hello BddPage!");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PM_Web } from "./PM/web";
|
|
2
|
+
import Testeranto from "./lib/core.js";
|
|
3
|
+
import { defaultTestResourceRequirement, } from "./lib/index.js";
|
|
4
|
+
let errorCallback = (e) => { };
|
|
5
|
+
let unhandledrejectionCallback = (event) => {
|
|
6
|
+
console.log("window.addEventListener unhandledrejection", event);
|
|
7
|
+
// cb({ error: event.reason.message });
|
|
8
|
+
// throw event;
|
|
9
|
+
};
|
|
10
|
+
export class WebTesteranto extends Testeranto {
|
|
11
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
|
|
12
|
+
super(input, testSpecification, testImplementation, testResourceRequirement, testInterface, (cb) => {
|
|
13
|
+
window.removeEventListener("error", errorCallback);
|
|
14
|
+
errorCallback = (e) => {
|
|
15
|
+
console.log("window.addEventListener error", e);
|
|
16
|
+
cb(e);
|
|
17
|
+
// throw e;
|
|
18
|
+
};
|
|
19
|
+
window.addEventListener("error", errorCallback);
|
|
20
|
+
window.removeEventListener("unhandledrejection", unhandledrejectionCallback);
|
|
21
|
+
/////////////////////
|
|
22
|
+
window.removeEventListener("unhandledrejection", unhandledrejectionCallback);
|
|
23
|
+
unhandledrejectionCallback = (event) => {
|
|
24
|
+
console.log("window.addEventListener unhandledrejection", event);
|
|
25
|
+
cb({ error: event.reason.message });
|
|
26
|
+
// throw event;
|
|
27
|
+
};
|
|
28
|
+
window.addEventListener("unhandledrejection", unhandledrejectionCallback);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async receiveTestResourceConfig(partialTestResource) {
|
|
32
|
+
const t = partialTestResource; //JSON.parse(partialTestResource);
|
|
33
|
+
const pm = new PM_Web(t);
|
|
34
|
+
const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
35
|
+
return new Promise((res, rej) => {
|
|
36
|
+
res({ features, failed });
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export default async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
41
|
+
return new WebTesteranto(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
|
|
42
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import readline from "readline";
|
|
4
|
+
import { glob } from "glob";
|
|
5
|
+
import esbuild from "esbuild";
|
|
6
|
+
import esbuildNodeConfiger from "./esbuildConfigs/node.js";
|
|
7
|
+
import esbuildWebConfiger from "./esbuildConfigs/web.js";
|
|
8
|
+
import webHtmlFrame from "./web.html.js";
|
|
9
|
+
readline.emitKeypressEvents(process.stdin);
|
|
10
|
+
if (process.stdin.isTTY)
|
|
11
|
+
process.stdin.setRawMode(true);
|
|
12
|
+
const getRunnables = (tests, payload = {
|
|
13
|
+
nodeEntryPoints: {},
|
|
14
|
+
webEntryPoints: {},
|
|
15
|
+
}) => {
|
|
16
|
+
return tests.reduce((pt, cv, cndx, cry) => {
|
|
17
|
+
if (cv[1] === "node") {
|
|
18
|
+
pt.nodeEntryPoints[cv[0]] = path.resolve(`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
|
|
19
|
+
}
|
|
20
|
+
else if (cv[1] === "web") {
|
|
21
|
+
pt.webEntryPoints[cv[0]] = path.resolve(`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
|
|
22
|
+
}
|
|
23
|
+
if (cv[3].length) {
|
|
24
|
+
getRunnables(cv[3], payload);
|
|
25
|
+
}
|
|
26
|
+
return pt;
|
|
27
|
+
}, payload);
|
|
28
|
+
};
|
|
29
|
+
import(process.cwd() + "/" + process.argv[2]).then(async (module) => {
|
|
30
|
+
const rawConfig = module.default;
|
|
31
|
+
const getSecondaryEndpointsPoints = (runtime) => {
|
|
32
|
+
const meta = (ts, st) => {
|
|
33
|
+
ts.forEach((t) => {
|
|
34
|
+
if (t[1] === runtime) {
|
|
35
|
+
st.add(t[0]);
|
|
36
|
+
}
|
|
37
|
+
if (Array.isArray(t[3])) {
|
|
38
|
+
meta(t[3], st);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return st;
|
|
42
|
+
};
|
|
43
|
+
return Array.from(meta(config.tests, new Set()));
|
|
44
|
+
};
|
|
45
|
+
const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/" + rawConfig.outdir });
|
|
46
|
+
let nodeDone = false;
|
|
47
|
+
let webDone = false;
|
|
48
|
+
let mode = config.devMode ? "DEV" : "PROD";
|
|
49
|
+
let status = "build";
|
|
50
|
+
// let pm: PM_Main | undefined = new PM_Main(config);
|
|
51
|
+
// const fileHashes = {};
|
|
52
|
+
const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
|
|
53
|
+
const onNodeDone = () => {
|
|
54
|
+
nodeDone = true;
|
|
55
|
+
onDone();
|
|
56
|
+
};
|
|
57
|
+
const onWebDone = () => {
|
|
58
|
+
webDone = true;
|
|
59
|
+
onDone();
|
|
60
|
+
};
|
|
61
|
+
const onDone = async () => {
|
|
62
|
+
if (nodeDone && webDone) {
|
|
63
|
+
status = "built";
|
|
64
|
+
}
|
|
65
|
+
if (nodeDone && webDone && status === "built") {
|
|
66
|
+
// Object.entries(nodeEntryPoints).forEach(([k, outputFile]) => {
|
|
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!");
|
|
95
|
+
process.exit();
|
|
96
|
+
}
|
|
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
|
+
};
|
|
118
|
+
console.log(`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`);
|
|
119
|
+
process.stdin.on("keypress", (str, key) => {
|
|
120
|
+
if (key.name === "q") {
|
|
121
|
+
console.log("Testeranto-Build is shutting down...");
|
|
122
|
+
mode = "PROD";
|
|
123
|
+
onDone();
|
|
124
|
+
}
|
|
125
|
+
if (key.name === "x") {
|
|
126
|
+
console.log("Testeranto-Build is shutting down forcefully...");
|
|
127
|
+
process.exit(-1);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
fs.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(config, null, 2));
|
|
131
|
+
Promise.resolve(Promise.all([...getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
|
|
132
|
+
const sourceFileSplit = sourceFilePath.split("/");
|
|
133
|
+
const sourceDir = sourceFileSplit.slice(0, -1);
|
|
134
|
+
const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
|
|
135
|
+
const sourceFileNameMinusJs = sourceFileName
|
|
136
|
+
.split(".")
|
|
137
|
+
.slice(0, -1)
|
|
138
|
+
.join(".");
|
|
139
|
+
const htmlFilePath = path.normalize(`${process.cwd()}/${config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
|
|
140
|
+
const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
|
|
141
|
+
return fs.promises
|
|
142
|
+
.mkdir(path.dirname(htmlFilePath), { recursive: true })
|
|
143
|
+
.then((x) => fs.writeFileSync(htmlFilePath, webHtmlFrame(jsfilePath, htmlFilePath)));
|
|
144
|
+
})));
|
|
145
|
+
glob(`./${config.outdir}/chunk-*.mjs`, {
|
|
146
|
+
ignore: "node_modules/**",
|
|
147
|
+
}).then((chunks) => {
|
|
148
|
+
chunks.forEach((chunk) => {
|
|
149
|
+
fs.unlinkSync(chunk);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
await Promise.all([
|
|
153
|
+
esbuild
|
|
154
|
+
.context(esbuildNodeConfiger(config, Object.keys(nodeEntryPoints)))
|
|
155
|
+
.then(async (nodeContext) => {
|
|
156
|
+
if (config.devMode) {
|
|
157
|
+
await nodeContext.watch().then((v) => {
|
|
158
|
+
onNodeDone();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
nodeContext.rebuild().then((v) => {
|
|
163
|
+
onNodeDone();
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return nodeContext;
|
|
167
|
+
}),
|
|
168
|
+
esbuild
|
|
169
|
+
.context(esbuildWebConfiger(config, Object.keys(webEntryPoints)))
|
|
170
|
+
.then(async (webContext) => {
|
|
171
|
+
if (config.devMode) {
|
|
172
|
+
await webContext.watch().then((v) => {
|
|
173
|
+
onWebDone();
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
webContext.rebuild().then((v) => {
|
|
178
|
+
onWebDone();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return webContext;
|
|
182
|
+
}),
|
|
183
|
+
]);
|
|
184
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
src: "src",
|
|
3
|
+
outdir: "docs",
|
|
4
|
+
tests: [],
|
|
5
|
+
debugger: true,
|
|
6
|
+
clearScreen: false,
|
|
7
|
+
devMode: true,
|
|
8
|
+
minify: false,
|
|
9
|
+
outbase: ".",
|
|
10
|
+
ports: ["3001"],
|
|
11
|
+
externals: [],
|
|
12
|
+
nodePlugins: [],
|
|
13
|
+
webPlugins: [],
|
|
14
|
+
featureIngestor: function (s) {
|
|
15
|
+
throw new Error("Function not implemented.");
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default config;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
export default {
|
|
3
|
+
name: "feature-markdown",
|
|
4
|
+
setup(build) {
|
|
5
|
+
build.onResolve({ filter: /\.md$/ }, (args) => {
|
|
6
|
+
if (args.resolveDir === "")
|
|
7
|
+
return;
|
|
8
|
+
return {
|
|
9
|
+
path: path.isAbsolute(args.path)
|
|
10
|
+
? args.path
|
|
11
|
+
: path.join(args.resolveDir, args.path),
|
|
12
|
+
namespace: "feature-markdown",
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
build.onLoad({ filter: /.*/, namespace: "feature-markdown" }, async (args) => {
|
|
16
|
+
// const markdownContent = new TextDecoder().decode(
|
|
17
|
+
// await fs.readFileSync(args.path)
|
|
18
|
+
// );
|
|
19
|
+
// markdownHTML = marked(markdownContent, options?.markedOptions);
|
|
20
|
+
return {
|
|
21
|
+
contents: `file://${args.path}`,
|
|
22
|
+
loader: "text",
|
|
23
|
+
// contents: JSON.stringify({ path: args.path }),
|
|
24
|
+
// loader: "json",
|
|
25
|
+
// contents: JSON.stringify({
|
|
26
|
+
// // html: markdownHTML,
|
|
27
|
+
// raw: markdownContent,
|
|
28
|
+
// filename: args.path, //path.basename(args.path),
|
|
29
|
+
// }),
|
|
30
|
+
// loader: "json",
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
};
|