testeranto 0.49.10 → 0.62.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/.nvmrc +1 -0
- package/README.md +71 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +53 -61
- package/dist/common/Project.js +272 -606
- package/dist/common/SubPackages/puppeteer.js +19 -0
- package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
- package/dist/common/SubPackages/react/jsx/index.js +13 -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 → SubPackages}/react-dom/component/node.js +6 -6
- package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +5 -14
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +26 -15
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
- package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
- package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +32 -0
- package/dist/common/Web.js +41 -112
- package/dist/common/electron.js +188 -44
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +35 -0
- package/dist/common/esbuildConfigs/report.js +48 -0
- package/dist/common/esbuildConfigs/tests.js +14 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/lib/abstractBase.js +193 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/browser.js +26 -0
- package/dist/common/lib/classBuilder.js +41 -0
- package/dist/common/lib/core.js +52 -0
- package/dist/common/lib/index.js +19 -0
- package/dist/common/nodeWriterElectron.js +55 -0
- package/dist/common/preload.js +22 -21
- package/dist/common/report.html.js +31 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/web.html.js +22 -0
- package/dist/module/Features.js +2 -3
- package/dist/module/Node.js +53 -61
- package/dist/module/Project.js +272 -583
- package/dist/module/SubPackages/puppeteer.js +14 -0
- package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
- package/dist/module/SubPackages/react/jsx/index.js +10 -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 → SubPackages}/react-dom/component/node.js +5 -5
- package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +4 -13
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +23 -15
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
- 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 → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +30 -1
- package/dist/module/Web.js +41 -112
- package/dist/module/electron.js +189 -45
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +30 -0
- package/dist/module/esbuildConfigs/report.js +48 -0
- package/dist/module/esbuildConfigs/tests.js +12 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/lib/abstractBase.js +185 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/browser.js +22 -0
- package/dist/module/lib/classBuilder.js +37 -0
- package/dist/module/lib/core.js +49 -0
- package/dist/module/lib/index.js +15 -0
- package/dist/module/nodeWriterElectron.js +52 -0
- package/dist/module/preload.js +22 -21
- package/dist/module/report.html.js +29 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/Report.css +10326 -0
- package/dist/prebuild/Report.js +37456 -0
- package/dist/types/Features.d.ts +5 -5
- package/dist/types/Node.d.ts +4 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -27
- package/dist/types/SubPackages/puppeteer.d.ts +6 -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 +15 -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 → SubPackages}/react-dom/component/node.d.ts +2 -4
- package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +9 -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 +8 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
- 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 → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
- 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 +116 -3
- package/dist/types/Web.d.ts +4 -11
- package/dist/types/esbuildConfigs/features.d.ts +4 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/report.d.ts +0 -0
- package/dist/types/esbuildConfigs/tests.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/lib/abstractBase.d.ts +102 -0
- package/dist/types/lib/basebuilder.d.ts +24 -0
- package/dist/types/lib/browser.d.ts +6 -0
- package/dist/types/lib/classBuilder.d.ts +6 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +57 -0
- package/dist/types/nodeWriterElectron.d.ts +2 -0
- package/dist/types/report.html.d.ts +2 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/web.html.d.ts +2 -0
- package/electronBuild.ts +32 -0
- package/index.html +30 -0
- package/package.json +120 -85
- package/src/Features.ts +2 -4
- package/src/Node.ts +114 -160
- package/src/NodeWriter.ts +1 -4
- package/src/Project.ts +610 -753
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +46 -0
- package/src/{subPackages → SubPackages}/react/component/node.ts +12 -32
- package/src/SubPackages/react/component/web.ts +53 -0
- package/src/SubPackages/react/jsx/index.ts +43 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +28 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +11 -25
- package/src/{subPackages → SubPackages}/react-dom/component/web.ts +27 -32
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +18 -54
- package/src/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.ts +9 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +31 -29
- package/src/SubPackages/react-test-renderer/component/node.ts +22 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +22 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/node.ts +14 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/web.ts +9 -25
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx/index.ts +19 -16
- package/src/SubPackages/react-test-renderer/jsx/node.ts +24 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +7 -15
- package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
- package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
- package/src/Types.ts +334 -3
- package/src/Web.ts +104 -230
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +237 -46
- package/src/esbuildConfigs/features.ts +18 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +59 -0
- package/src/esbuildConfigs/report.ts +51 -0
- package/src/esbuildConfigs/tests.ts +20 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +459 -0
- package/src/lib/basebuilder.ts +253 -0
- package/src/lib/browser.ts +34 -0
- package/src/lib/classBuilder.ts +137 -0
- package/src/lib/core.ts +182 -0
- package/src/lib/index.ts +116 -0
- package/src/nodeWriterElectron.ts +71 -0
- package/src/preload.ts +23 -21
- package/src/report.html.ts +29 -0
- package/src/web.html.ts +20 -0
- package/tests/Rectangle.test.ts +189 -0
- package/tsconfig.json +19 -6
- package/tsconfig.module.json +15 -4
- package/tsconfig.types.json +14 -4
- package/yarn-error.log +3144 -0
- package/dist/common/core.js +0 -397
- package/dist/common/subPackages/react/jsx/index.js +0 -26
- package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
- package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
- package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
- package/dist/module/Report.js +0 -186
- package/dist/module/core.js +0 -388
- package/dist/module/subPackages/react/jsx/index.js +0 -22
- package/dist/module/subPackages/react/jsx/node.js +0 -5
- package/dist/module/subPackages/react/jsx/web.js +0 -5
- package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
- package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
- package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
- package/dist/types/core.d.ts +0 -220
- package/dist/types/subPackages/react/component/node.d.ts +0 -12
- package/dist/types/subPackages/react/component/web.d.ts +0 -12
- package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
- package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
- package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
- package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
- package/dist/types/subPackages/react-test-renderer/component/node.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
- package/src/core.ts +0 -1399
- package/src/subPackages/react/component/web.ts +0 -80
- package/src/subPackages/react/jsx/index.ts +0 -64
- package/src/subPackages/react/jsx/node.ts +0 -29
- package/src/subPackages/react/jsx/web.ts +0 -29
- package/src/subPackages/react-dom/jsx/node.ts +0 -145
- package/src/subPackages/react-test-renderer/component/node.ts +0 -30
- package/src/subPackages/react-test-renderer/component/web.ts +0 -30
- package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
- /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
package/dist/common/Web.js
CHANGED
|
@@ -3,121 +3,50 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
const receiveTestResourceConfigScheduled = async (t, testresource) => {
|
|
23
|
-
const { failed, artifacts, logPromise } = await t.receiveTestResourceConfig(testresource);
|
|
24
|
-
webSocket.send(JSON.stringify({
|
|
25
|
-
type: "testeranto:adios",
|
|
26
|
-
data: {
|
|
27
|
-
failed,
|
|
28
|
-
testResourceConfiguration: t.test.testResourceConfiguration,
|
|
29
|
-
results: t.toObj(),
|
|
30
|
-
},
|
|
31
|
-
}));
|
|
32
|
-
Promise.all([...artifacts, logPromise]).then(async () => {
|
|
33
|
-
// ipcRenderer.invoke('quit-app', failed);
|
|
34
|
-
window.exit(failed);
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = core_1.defaultTestResourceRequirement) => {
|
|
38
|
-
console.log("web NodeWriter", window.NodeWriter);
|
|
39
|
-
const mrt = new core_2.default(input, testSpecification, testImplementation, testInterface, testResourceRequirement, testInterface.assertioner || (async (t) => t), testInterface.beforeEach ||
|
|
40
|
-
async function (subject, initialValues, testResource) {
|
|
41
|
-
return subject;
|
|
42
|
-
}, testInterface.afterEach || (async (s) => s), testInterface.afterAll || ((store) => undefined), testInterface.butThen || (async (a) => a), testInterface.andWhen, testInterface.actionHandler ||
|
|
43
|
-
function (b) {
|
|
44
|
-
return b;
|
|
45
|
-
}, window.NodeWriter);
|
|
46
|
-
const tl2 = mrt;
|
|
47
|
-
const t = tl2.testJobs[0];
|
|
48
|
-
const testResourceArg = decodeURIComponent(new URLSearchParams(location.search).get('requesting') || '');
|
|
49
|
-
try {
|
|
50
|
-
const partialTestResource = JSON.parse(testResourceArg);
|
|
51
|
-
console.log("initial test resource", partialTestResource);
|
|
52
|
-
if (partialTestResource.scheduled) {
|
|
53
|
-
console.log("test is scheduled");
|
|
54
|
-
console.log("awaiting test resources via WS...");
|
|
55
|
-
webSocket.addEventListener("open", (event) => {
|
|
56
|
-
webSocket.addEventListener("message", (event) => {
|
|
57
|
-
console.log("Message from server ", event.data);
|
|
58
|
-
});
|
|
59
|
-
const r = JSON.stringify({
|
|
60
|
-
type: "testeranto:hola",
|
|
61
|
-
data: {
|
|
62
|
-
requirement: Object.assign(Object.assign({}, testResourceRequirement), { name: partialTestResource.name })
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
webSocket.send(r);
|
|
66
|
-
console.log("awaiting test resources via websocket...", r);
|
|
67
|
-
webSocket.onmessage = (async (msg) => {
|
|
68
|
-
console.log("message: ", msg);
|
|
69
|
-
const resourcesFromWs = JSON.parse(msg.data);
|
|
70
|
-
console.log("secondary test resource", resourcesFromWs);
|
|
71
|
-
const secondTestResource = Object.assign(Object.assign({ fs: "." }, JSON.parse(JSON.stringify(partialTestResource))), JSON.parse(JSON.stringify(resourcesFromWs)));
|
|
72
|
-
console.log("final test resource", secondTestResource);
|
|
73
|
-
receiveTestResourceConfigScheduled(t, secondTestResource);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
6
|
+
const core_js_1 = __importDefault(require("./lib/core.js"));
|
|
7
|
+
const index_js_1 = require("./lib/index.js");
|
|
8
|
+
const remote = require('@electron/remote');
|
|
9
|
+
class WebTesteranto extends core_js_1.default {
|
|
10
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
|
|
11
|
+
super(input, testSpecification, testImplementation, testResourceRequirement, window.NodeWriter, testInterface);
|
|
12
|
+
if (process.argv[2]) {
|
|
13
|
+
const testResourceArg = decodeURIComponent(new URLSearchParams(location.search).get('requesting') || '');
|
|
14
|
+
try {
|
|
15
|
+
const partialTestResource = JSON.parse(testResourceArg);
|
|
16
|
+
this.receiveTestResourceConfig(this.testJobs[0], partialTestResource);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
console.error(e);
|
|
20
|
+
// process.exit(-1);
|
|
21
|
+
}
|
|
76
22
|
}
|
|
77
23
|
else {
|
|
78
|
-
|
|
24
|
+
// no-op
|
|
25
|
+
}
|
|
26
|
+
const requesting = new URLSearchParams(location.search).get('requesting');
|
|
27
|
+
if (requesting) {
|
|
28
|
+
const testResourceArg = decodeURIComponent(requesting);
|
|
29
|
+
try {
|
|
30
|
+
const partialTestResource = JSON.parse(testResourceArg);
|
|
31
|
+
console.log("initial test resource", partialTestResource);
|
|
32
|
+
this.receiveTestResourceConfig(this.testJobs[0], partialTestResource);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
console.error(e);
|
|
36
|
+
// process.exit(-1);
|
|
37
|
+
}
|
|
79
38
|
}
|
|
80
|
-
// const
|
|
81
|
-
// testResourceArg
|
|
82
|
-
// ) as ITTestResourceConfiguration;
|
|
83
|
-
// if (partialTestResource.fs && partialTestResource.ports) {
|
|
84
|
-
// receiveTestResourceConfig(t, partialTestResource);
|
|
85
|
-
// } else {
|
|
86
|
-
// console.log("test configuration is incomplete", partialTestResource);
|
|
87
|
-
// console.log(
|
|
88
|
-
// "requesting test resources via ws",
|
|
89
|
-
// testResourceRequirement
|
|
90
|
-
// );
|
|
91
|
-
// webSocket.addEventListener("open", (event) => {
|
|
92
|
-
// webSocket.addEventListener("message", (event) => {
|
|
93
|
-
// console.log("Message from server ", event.data);
|
|
94
|
-
// });
|
|
95
|
-
// const r = JSON.stringify({
|
|
96
|
-
// type: "testeranto:hola",
|
|
97
|
-
// data: {
|
|
98
|
-
// testResourceRequirement,
|
|
99
|
-
// },
|
|
100
|
-
// });
|
|
101
|
-
// webSocket.send(r);
|
|
102
|
-
// console.log("awaiting test resources via websocket...", r);
|
|
103
|
-
// webSocket.onmessage = (
|
|
104
|
-
// async (msg: MessageEvent<any>) => {
|
|
105
|
-
// console.log("message: ", msg);
|
|
106
|
-
// const resourcesFromPm2 = msg.data.testResourceConfiguration;
|
|
107
|
-
// const secondTestResource = {
|
|
108
|
-
// fs: ".",
|
|
109
|
-
// ...JSON.parse(JSON.stringify(partialTestResource)),
|
|
110
|
-
// ...JSON.parse(JSON.stringify(resourcesFromPm2)),
|
|
111
|
-
// } as ITTestResourceConfiguration;
|
|
112
|
-
// console.log("secondTestResource", secondTestResource);
|
|
113
|
-
// receiveTestResourceConfig(t, secondTestResource);
|
|
114
|
-
// }
|
|
115
|
-
// );
|
|
116
|
-
// });
|
|
117
|
-
// }
|
|
39
|
+
// const t: ITestJob = this.testJobs[0];
|
|
118
40
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
41
|
+
async receiveTestResourceConfig(t, partialTestResource) {
|
|
42
|
+
const { failed, artifacts, logPromise } = await t.receiveTestResourceConfig(partialTestResource, remote);
|
|
43
|
+
Promise.all([...artifacts, logPromise]).then(async () => {
|
|
44
|
+
var window = remote.getCurrentWindow();
|
|
45
|
+
// window.close();
|
|
46
|
+
});
|
|
122
47
|
}
|
|
48
|
+
}
|
|
49
|
+
;
|
|
50
|
+
exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
|
|
51
|
+
return new WebTesteranto(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
|
|
123
52
|
};
|
package/dist/common/electron.js
CHANGED
|
@@ -4,49 +4,193 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const electron_1 = require("electron");
|
|
7
|
+
const puppeteer_in_electron_1 = __importDefault(require("puppeteer-in-electron"));
|
|
8
|
+
const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
10
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
const jsonc_1 = require("jsonc");
|
|
12
|
+
const remoteMain = require("@electron/remote/main");
|
|
13
|
+
remoteMain.initialize();
|
|
14
|
+
const main = async () => {
|
|
15
|
+
const configs = jsonc_1.jsonc.parse((await fs_1.default.readFileSync("./docs/testeranto.json")).toString());
|
|
16
|
+
const loadReport = (configs) => {
|
|
17
|
+
const win = new electron_1.BrowserWindow({
|
|
18
|
+
show: true,
|
|
19
|
+
webPreferences: {
|
|
20
|
+
offscreen: false,
|
|
21
|
+
devTools: true,
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
win.loadFile(`/${configs.buildDir}/report.html`).then(async (x) => {
|
|
25
|
+
// pie.connect(app, puppeteer).then(async (browser) => {
|
|
26
|
+
// pie.getPage(browser, win).then(async (page) => {
|
|
27
|
+
// await page.screenshot({
|
|
28
|
+
// path: 'electron-puppeteer-screenshot1.jpg'
|
|
29
|
+
// });
|
|
30
|
+
// })
|
|
31
|
+
// })
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const launchNode = (t, x) => {
|
|
35
|
+
var _a;
|
|
36
|
+
const f = x.replace(".ts", ".mjs");
|
|
37
|
+
const a = JSON.stringify({
|
|
38
|
+
scheduled: true,
|
|
39
|
+
name: x,
|
|
40
|
+
ports: [],
|
|
41
|
+
fs: path_1.default.resolve(configs.buildDir, "node", t),
|
|
42
|
+
});
|
|
43
|
+
console.log("launchNode", f, a);
|
|
44
|
+
const child = electron_1.utilityProcess.fork(f, [a], {});
|
|
45
|
+
child.postMessage({ message: 'hello' });
|
|
46
|
+
child.on('message', (data) => {
|
|
47
|
+
console.log("from child", data);
|
|
48
|
+
launchWebSecondary(process.cwd() + data);
|
|
49
|
+
});
|
|
50
|
+
child.on('exit', (data) => {
|
|
51
|
+
console.log("node process ended with: ", data);
|
|
52
|
+
fileStream.close();
|
|
53
|
+
});
|
|
54
|
+
// child.stdout
|
|
55
|
+
// child..on("", (data) => {
|
|
56
|
+
// console.log("from child", data) // hello world!
|
|
57
|
+
// launchWebSecondary(process.cwd() + data);
|
|
58
|
+
// })
|
|
59
|
+
// Create a write stream for the file
|
|
60
|
+
const fileStream = fs_1.default.createWriteStream('errors.txt');
|
|
61
|
+
// Pipe the child process's stdout to the file
|
|
62
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.pipe(fileStream);
|
|
63
|
+
// // Handle errors
|
|
64
|
+
// child.on('error', (err) => {
|
|
65
|
+
// console.error('Error spawning child process:', err);
|
|
66
|
+
// });
|
|
67
|
+
// fileStream.on('error', (err) => {
|
|
68
|
+
// console.error('Error writing to file:', err);
|
|
69
|
+
// });
|
|
70
|
+
// // Log a message when the child process exits
|
|
71
|
+
// child.on('close', (code) => {
|
|
72
|
+
// console.log(`Child process exited with code ${code}`);
|
|
73
|
+
// });
|
|
74
|
+
// console.log("child", child);
|
|
75
|
+
// child.stdout?.on("data", (x) => {
|
|
76
|
+
// console.log("x", x)
|
|
77
|
+
// })
|
|
78
|
+
};
|
|
79
|
+
const launchWebSecondary = (htmlFile) => {
|
|
80
|
+
console.log("launchWebSecondary", htmlFile);
|
|
81
|
+
const subWin = new electron_1.BrowserWindow({
|
|
82
|
+
show: true,
|
|
83
|
+
webPreferences: {
|
|
84
|
+
nodeIntegration: true,
|
|
85
|
+
nodeIntegrationInWorker: true,
|
|
86
|
+
contextIsolation: false,
|
|
87
|
+
preload: path_1.default.join(electron_1.app.getAppPath(), 'preload.js'),
|
|
88
|
+
offscreen: false,
|
|
89
|
+
devTools: false,
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
remoteMain.enable(subWin.webContents);
|
|
93
|
+
subWin.webContents.openDevTools();
|
|
94
|
+
subWin.loadFile(htmlFile);
|
|
95
|
+
};
|
|
96
|
+
const launchWeb = (t, changedFile) => {
|
|
97
|
+
console.log("launchWeb", changedFile);
|
|
98
|
+
const subWin = new electron_1.BrowserWindow({
|
|
99
|
+
show: true,
|
|
100
|
+
webPreferences: {
|
|
101
|
+
nodeIntegration: true,
|
|
102
|
+
nodeIntegrationInWorker: true,
|
|
103
|
+
contextIsolation: false,
|
|
104
|
+
preload: path_1.default.join(electron_1.app.getAppPath(), 'preload.js'),
|
|
105
|
+
offscreen: false,
|
|
106
|
+
devTools: true,
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
remoteMain.enable(subWin.webContents);
|
|
110
|
+
// subWin.webContents.openDevTools()
|
|
111
|
+
const htmlFile = changedFile.split(".").slice(0, -1).concat("html").join(".");
|
|
112
|
+
subWin.loadFile(htmlFile, {
|
|
113
|
+
query: {
|
|
114
|
+
requesting: encodeURIComponent(JSON.stringify({
|
|
115
|
+
name: changedFile,
|
|
116
|
+
ports: [].toString(),
|
|
117
|
+
fs: path_1.default.resolve(configs.buildDir, "web", t),
|
|
118
|
+
}))
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
const watcher = (test, runtime) => {
|
|
123
|
+
return path_1.default.normalize(`${configs.buildDir}/${runtime}/${test.split('.').slice(0, -1).concat('mjs').join('.')}`);
|
|
124
|
+
};
|
|
125
|
+
const changer = (f) => {
|
|
126
|
+
return path_1.default.normalize(`${configs.buildDir}/${f}`);
|
|
127
|
+
};
|
|
128
|
+
const changer2 = (f, r) => {
|
|
129
|
+
return path_1.default.normalize(`${configs.buildDir}/${r}/${f}`);
|
|
130
|
+
};
|
|
131
|
+
puppeteer_in_electron_1.default.initialize(electron_1.app, 2999).then(async () => {
|
|
132
|
+
electron_1.app.on("ready", () => {
|
|
133
|
+
loadReport(configs);
|
|
134
|
+
console.log("running all the tests once initially");
|
|
135
|
+
;
|
|
136
|
+
configs.modules.forEach((t) => {
|
|
137
|
+
if (t.runtime === "node") {
|
|
138
|
+
launchNode(t.test, changer2(t.test, "node"));
|
|
139
|
+
}
|
|
140
|
+
else if (t.runtime === "web") {
|
|
141
|
+
launchWeb(t.test, changer2(t.test, "web"));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
console.error("runtime makes no sense", t.runtime);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
console.log("ready and watching for changes...", configs.buildDir);
|
|
148
|
+
fs_1.default.watch(configs.buildDir, {
|
|
149
|
+
recursive: true,
|
|
150
|
+
}, (eventType, changedFile) => {
|
|
151
|
+
console.log(eventType, changedFile);
|
|
152
|
+
if (changedFile) {
|
|
153
|
+
configs.modules.forEach((t) => {
|
|
154
|
+
if (watcher(t.test, t.runtime) === changer(changedFile)) {
|
|
155
|
+
if (t.runtime === "node") {
|
|
156
|
+
launchNode(t.test, changer(changedFile));
|
|
157
|
+
}
|
|
158
|
+
else if (t.runtime === "web") {
|
|
159
|
+
launchWeb(t.test, changer(changedFile));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
console.error("runtime makes no sense", t.runtime);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
23
169
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// app.exit(failed);
|
|
52
|
-
});
|
|
170
|
+
await puppeteer_in_electron_1.default.connect(electron_1.app, puppeteer_core_1.default);
|
|
171
|
+
};
|
|
172
|
+
main();
|
|
173
|
+
// ipcMain.handle('web-log', (x, message: string) => {
|
|
174
|
+
// console.log("web-log)", message);
|
|
175
|
+
// });
|
|
176
|
+
// ipcMain.handle('web-error', (x, message: string) => {
|
|
177
|
+
// console.log("web-error)", message);
|
|
178
|
+
// });
|
|
179
|
+
// ipcMain.handle('web-warn', (x, message: string) => {
|
|
180
|
+
// console.log("web-warn)", message);
|
|
181
|
+
// });
|
|
182
|
+
// ipcMain.handle('web-info', (x, message: string) => {
|
|
183
|
+
// console.log("web-info)", message);
|
|
184
|
+
// });
|
|
185
|
+
// ipcMain.handle('quit-app', (x, failed: number) => {
|
|
186
|
+
// console.log("quit-app", failed);
|
|
187
|
+
// app.exit(failed);
|
|
188
|
+
// });
|
|
189
|
+
// process.stdin.on("data", (configTests) => {
|
|
190
|
+
// main(JSON.parse(configTests.toString()) as ITestTypes[]);
|
|
191
|
+
// });
|
|
192
|
+
// const watchables = (tests: ITestTypes[]) => {
|
|
193
|
+
// return tests.map((t) => {
|
|
194
|
+
// return [t[1], `dist/${t[1]}/${t[0].replace(".mts", ".mjs")}`]
|
|
195
|
+
// })
|
|
196
|
+
// }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = (config) => {
|
|
4
|
+
return {
|
|
5
|
+
bundle: true,
|
|
6
|
+
entryPoints: [config.features],
|
|
7
|
+
minify: config.minify === true,
|
|
8
|
+
outbase: config.outbase,
|
|
9
|
+
write: true,
|
|
10
|
+
outfile: `${config.outdir}/features.test.js`,
|
|
11
|
+
// external: ["graphology"],
|
|
12
|
+
format: "esm",
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = (config) => {
|
|
4
|
+
return {
|
|
5
|
+
target: "esnext",
|
|
6
|
+
format: "esm",
|
|
7
|
+
splitting: true,
|
|
8
|
+
outExtension: { '.js': '.mjs' },
|
|
9
|
+
outbase: config.outbase,
|
|
10
|
+
jsx: 'transform',
|
|
11
|
+
bundle: true,
|
|
12
|
+
minify: config.minify === true,
|
|
13
|
+
write: true,
|
|
14
|
+
loader: {
|
|
15
|
+
'.js': 'jsx',
|
|
16
|
+
'.png': 'binary',
|
|
17
|
+
'.jpg': 'binary',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const index_js_1 = __importDefault(require("./index.js"));
|
|
7
|
+
// const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
|
|
8
|
+
exports.default = (config, entryPoints) => {
|
|
9
|
+
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], supported: {
|
|
10
|
+
"dynamic-import": true
|
|
11
|
+
}, define: {
|
|
12
|
+
"process.env.FLUENTFFMPEG_COV": "0"
|
|
13
|
+
}, absWorkingDir: process.cwd(), banner: {
|
|
14
|
+
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
|
|
15
|
+
}, platform: "node", external: [
|
|
16
|
+
"testeranto.json",
|
|
17
|
+
"features.test.js",
|
|
18
|
+
"react",
|
|
19
|
+
"events",
|
|
20
|
+
// "ganache"
|
|
21
|
+
...config.externals
|
|
22
|
+
], entryPoints: [...entryPoints], plugins: [
|
|
23
|
+
...(config.nodePlugins || []),
|
|
24
|
+
{
|
|
25
|
+
name: 'rebuild-notify',
|
|
26
|
+
setup(build) {
|
|
27
|
+
build.onEnd(result => {
|
|
28
|
+
console.log(`node build ended with ${result.errors.length} errors`);
|
|
29
|
+
console.log(result);
|
|
30
|
+
result.errors.length !== 0 && process.exit(-1);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { jsonc } from "jsonc";
|
|
3
|
+
// import { IBaseConfig, IJsonConfig } from "../Types";
|
|
4
|
+
// import baseEsBuildConfig from "./index.js";
|
|
5
|
+
// import fs from "fs"
|
|
6
|
+
// import { BuildOptions } from "esbuild";
|
|
7
|
+
// // import { CssModulesPlugin } from 'esbuild-css-modules-plugin';
|
|
8
|
+
// const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
|
|
9
|
+
// export default (config: IBaseConfig): BuildOptions => {
|
|
10
|
+
// return {
|
|
11
|
+
// bundle: true,
|
|
12
|
+
// entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
|
|
13
|
+
// minify: config.minify === true,
|
|
14
|
+
// outbase: config.outbase,
|
|
15
|
+
// write: true,
|
|
16
|
+
// outfile: `${jsonConfig.outdir}/report.js`,
|
|
17
|
+
// external: [
|
|
18
|
+
// "tests.json",
|
|
19
|
+
// "features.test.js"
|
|
20
|
+
// ],
|
|
21
|
+
// // plugins: [
|
|
22
|
+
// // CssModulesPlugin({
|
|
23
|
+
// // // @see https://github.com/indooorsman/esbuild-css-modules-plugin/blob/main/index.d.ts for more details
|
|
24
|
+
// // force: true,
|
|
25
|
+
// // emitDeclarationFile: true,
|
|
26
|
+
// // localsConvention: 'camelCaseOnly',
|
|
27
|
+
// // namedExports: true,
|
|
28
|
+
// // inject: false
|
|
29
|
+
// // })
|
|
30
|
+
// // ]
|
|
31
|
+
// }
|
|
32
|
+
// // return {
|
|
33
|
+
// // bundle: true,
|
|
34
|
+
// // entryPoints: [
|
|
35
|
+
// // "./node_modules/testeranto/dist/module/Report.js",
|
|
36
|
+
// // jsonConfig.features
|
|
37
|
+
// // ],
|
|
38
|
+
// // minify: config.minify === true,
|
|
39
|
+
// // outbase: ".",
|
|
40
|
+
// // outdir: 'docs',
|
|
41
|
+
// // write: true,
|
|
42
|
+
// // // outfile: `${jsonConfig.outdir}/Report.js`,
|
|
43
|
+
// // external: [
|
|
44
|
+
// // "features.test.js",
|
|
45
|
+
// // "testeranto.json"
|
|
46
|
+
// // ]
|
|
47
|
+
// // }
|
|
48
|
+
// }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
|
|
4
|
+
exports.default = (config) => {
|
|
5
|
+
return {
|
|
6
|
+
bundle: true,
|
|
7
|
+
entryPoints: [config.features],
|
|
8
|
+
minify: config.minify === true,
|
|
9
|
+
outbase: config.outbase,
|
|
10
|
+
write: true,
|
|
11
|
+
outfile: `${config.outdir}/tests.test.js`,
|
|
12
|
+
// external: ["graphology"]
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const index_js_1 = __importDefault(require("./index.js"));
|
|
8
|
+
// const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
|
|
9
|
+
exports.default = (config, entryPoints) => {
|
|
10
|
+
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), {
|
|
11
|
+
// inject: ['./node_modules/testeranto/dist/cjs-shim.js'],
|
|
12
|
+
// banner: {
|
|
13
|
+
// js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
|
|
14
|
+
// },
|
|
15
|
+
outdir: config.outdir + "/web", alias: {
|
|
16
|
+
react: path_1.default.resolve("./node_modules/react")
|
|
17
|
+
}, external: [
|
|
18
|
+
"testeranto.json",
|
|
19
|
+
"features.test.ts",
|
|
20
|
+
// "url",
|
|
21
|
+
"react",
|
|
22
|
+
"electron",
|
|
23
|
+
"path",
|
|
24
|
+
"fs",
|
|
25
|
+
"stream",
|
|
26
|
+
"http",
|
|
27
|
+
"constants",
|
|
28
|
+
"net",
|
|
29
|
+
"assert",
|
|
30
|
+
"tls",
|
|
31
|
+
"os",
|
|
32
|
+
"child_process",
|
|
33
|
+
"readline",
|
|
34
|
+
"zlib",
|
|
35
|
+
"crypto",
|
|
36
|
+
"https"
|
|
37
|
+
], platform: "browser", entryPoints: [...entryPoints], plugins: [
|
|
38
|
+
...(config.webPlugins || []),
|
|
39
|
+
{
|
|
40
|
+
name: 'rebuild-notify',
|
|
41
|
+
setup(build) {
|
|
42
|
+
build.onEnd(result => {
|
|
43
|
+
console.log(`web build ended with ${result.errors.length} errors`);
|
|
44
|
+
console.log(result);
|
|
45
|
+
result.errors.length !== 0 && process.exit(-1);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
] });
|
|
50
|
+
};
|