testeranto 0.49.10 → 0.70.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 +92 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +37 -62
- package/dist/common/NodeWriter.js +7 -9
- package/dist/common/Project.js +130 -627
- 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 +19 -20
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +25 -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 -3
- 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 +3 -3
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +49 -113
- package/dist/common/electron.js +256 -42
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +37 -0
- package/dist/common/esbuildConfigs/report.js +13 -0
- package/dist/common/esbuildConfigs/tests.js +13 -0
- package/dist/common/esbuildConfigs/web.js +53 -0
- package/dist/common/lib/abstractBase.js +200 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/classBuilder.js +40 -0
- package/dist/common/lib/core.js +81 -0
- package/dist/common/lib/index.js +21 -0
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +15 -24
- package/dist/common/puppeteerConfiger.js +24 -0
- 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 +37 -62
- package/dist/module/NodeWriter.js +7 -9
- package/dist/module/Project.js +131 -605
- 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 +7 -7
- 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 +20 -21
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +22 -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 -3
- 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 +3 -3
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +2 -0
- package/dist/module/Web.js +49 -113
- package/dist/module/electron.js +257 -43
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +32 -0
- package/dist/module/esbuildConfigs/report.js +11 -0
- package/dist/module/esbuildConfigs/tests.js +11 -0
- package/dist/module/esbuildConfigs/web.js +48 -0
- package/dist/module/lib/abstractBase.js +192 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/classBuilder.js +36 -0
- package/dist/module/lib/core.js +78 -0
- package/dist/module/lib/index.js +17 -0
- package/dist/module/lib/types.js +1 -0
- package/dist/module/preload.js +12 -24
- package/dist/module/puppeteerConfiger.js +19 -0
- 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 +5 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -28
- 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/react-dom/component/node.d.ts +12 -0
- 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 → SubPackages}/react-test-renderer/component/node.d.ts +4 -4
- 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 +49 -17
- package/dist/types/Web.d.ts +5 -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 +4 -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 +103 -0
- package/dist/types/lib/basebuilder.d.ts +25 -0
- package/dist/types/lib/classBuilder.d.ts +7 -0
- package/dist/types/lib/core.d.ts +8 -0
- package/dist/types/lib/index.d.ts +58 -0
- package/dist/types/lib/types.d.ts +70 -0
- package/dist/types/puppeteerConfiger.d.ts +4 -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 +123 -87
- package/src/Features.ts +2 -4
- package/src/Node.ts +79 -155
- package/src/NodeWriter.ts +22 -22
- package/src/Project.ts +185 -783
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +51 -0
- package/src/SubPackages/react/component/node.ts +43 -0
- package/src/SubPackages/react/component/web.ts +43 -0
- package/src/SubPackages/react/jsx/index.ts +32 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +30 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +24 -44
- package/src/SubPackages/react-dom/component/web.ts +104 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/SubPackages/react-dom/jsx/web.ts +102 -0
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +38 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +37 -49
- package/src/SubPackages/react-test-renderer/component/node.ts +16 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +16 -0
- package/src/SubPackages/react-test-renderer/fc/node.ts +49 -0
- package/src/SubPackages/react-test-renderer/fc/web.ts +48 -0
- package/src/SubPackages/react-test-renderer/jsx/index.ts +49 -0
- package/src/SubPackages/react-test-renderer/jsx/node.ts +20 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +15 -26
- 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 +114 -17
- package/src/Web.ts +100 -225
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +303 -45
- package/src/esbuildConfigs/features.ts +17 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +60 -0
- package/src/esbuildConfigs/report.ts +15 -0
- package/src/esbuildConfigs/tests.ts +14 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +412 -0
- package/src/lib/basebuilder.ts +228 -0
- package/src/lib/classBuilder.ts +118 -0
- package/src/lib/core.ts +214 -0
- package/src/lib/index.ts +117 -0
- package/src/lib/types.ts +206 -0
- package/src/preload.ts +13 -27
- package/src/puppeteerConfiger.ts +26 -0
- 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/node.d.ts +0 -14
- 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/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/node.ts +0 -75
- 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/component/web.ts +0 -129
- package/src/subPackages/react-dom/jsx/node.ts +0 -145
- package/src/subPackages/react-dom/jsx/web.ts +0 -145
- package/src/subPackages/react-test-renderer/MemoExoticComponent/node.ts +0 -67
- 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/fc/node.ts +0 -77
- package/src/subPackages/react-test-renderer/fc/web.ts +0 -77
- package/src/subPackages/react-test-renderer/jsx/index.ts +0 -51
- 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/src/Types.ts
CHANGED
|
@@ -1,20 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { ITTestResourceRequest, ITestCheckCallback } from "./lib/index.js";
|
|
2
|
+
import {
|
|
3
|
+
IGivens,
|
|
4
|
+
BaseCheck,
|
|
5
|
+
BaseSuite,
|
|
6
|
+
BaseWhen,
|
|
7
|
+
BaseThen,
|
|
8
|
+
BaseGiven,
|
|
9
|
+
} from "./lib/abstractBase.js";
|
|
10
|
+
import Testeranto from "./lib/core.js";
|
|
11
|
+
import {
|
|
12
|
+
INodeTestInterface,
|
|
13
|
+
ITestInterface,
|
|
14
|
+
IWebTestInterface,
|
|
15
|
+
} from "./lib/types.js";
|
|
16
|
+
|
|
17
|
+
export type IPartialInterface<I extends IBaseTest> = Partial<ITestInterface<I>>;
|
|
18
|
+
|
|
19
|
+
export type IPartialNodeInterface<I extends IBaseTest> = Partial<
|
|
20
|
+
INodeTestInterface<I>
|
|
21
|
+
>;
|
|
22
|
+
export type IPartialWebInterface<I extends IBaseTest> = Partial<
|
|
23
|
+
IWebTestInterface<I>
|
|
24
|
+
>;
|
|
25
|
+
|
|
26
|
+
export type IEntry<ITestShape extends IBaseTest> = (
|
|
27
|
+
input: ITestShape["iinput"],
|
|
28
|
+
testSpecification: ITestSpecification<ITestShape>,
|
|
29
|
+
testImplementation: ITestImplementation<ITestShape, object>,
|
|
30
|
+
testInterface: IPartialInterface<ITestShape>,
|
|
31
|
+
testResourceRequirement: ITTestResourceRequest
|
|
32
|
+
) => Promise<Testeranto<ITestShape>>;
|
|
33
|
+
|
|
34
|
+
export type ITestSpecification<ITestShape extends IBaseTest> = (
|
|
35
|
+
Suite: {
|
|
36
|
+
[K in keyof ITestShape["suites"]]: (
|
|
37
|
+
name: string,
|
|
38
|
+
givens: IGivens<ITestShape>,
|
|
39
|
+
checks: BaseCheck<ITestShape>[]
|
|
40
|
+
) => BaseSuite<ITestShape>;
|
|
41
|
+
},
|
|
42
|
+
Given: {
|
|
43
|
+
[K in keyof ITestShape["givens"]]: (
|
|
44
|
+
features: string[],
|
|
45
|
+
whens: BaseWhen<ITestShape>[],
|
|
46
|
+
thens: BaseThen<ITestShape>[],
|
|
47
|
+
...xtrasB: ITestShape["givens"][K]
|
|
48
|
+
) => BaseGiven<ITestShape>;
|
|
49
|
+
},
|
|
50
|
+
When: {
|
|
51
|
+
[K in keyof ITestShape["whens"]]: (
|
|
52
|
+
...xtrasC: ITestShape["whens"][K]
|
|
53
|
+
) => BaseWhen<ITestShape>;
|
|
54
|
+
},
|
|
55
|
+
Then: {
|
|
56
|
+
[K in keyof ITestShape["thens"]]: (
|
|
57
|
+
...xtrasD: ITestShape["thens"][K]
|
|
58
|
+
) => BaseThen<ITestShape>;
|
|
59
|
+
},
|
|
60
|
+
Check: ITestCheckCallback<ITestShape>
|
|
61
|
+
) => any[];
|
|
62
|
+
|
|
63
|
+
export type ITestImplementation<
|
|
64
|
+
ITestShape extends IBaseTest,
|
|
65
|
+
IMod = object
|
|
66
|
+
> = Modify<
|
|
67
|
+
{
|
|
68
|
+
suites: {
|
|
69
|
+
[K in keyof ITestShape["suites"]]: string;
|
|
70
|
+
};
|
|
71
|
+
givens: {
|
|
72
|
+
[K in keyof ITestShape["givens"]]: (
|
|
73
|
+
...Ig: ITestShape["givens"][K]
|
|
74
|
+
) => ITestShape["given"];
|
|
75
|
+
};
|
|
76
|
+
whens: {
|
|
77
|
+
[K in keyof ITestShape["whens"]]: (
|
|
78
|
+
...Iw: ITestShape["whens"][K]
|
|
79
|
+
) => (zel: ITestShape["iselection"]) => ITestShape["when"];
|
|
80
|
+
};
|
|
81
|
+
thens: {
|
|
82
|
+
[K in keyof ITestShape["thens"]]: (
|
|
83
|
+
...It: ITestShape["thens"][K]
|
|
84
|
+
) => (ssel: ITestShape["iselection"]) => ITestShape["then"];
|
|
85
|
+
};
|
|
86
|
+
checks: {
|
|
87
|
+
[K in keyof ITestShape["checks"]]: (
|
|
88
|
+
...Ic: ITestShape["checks"][K]
|
|
89
|
+
) => ITestShape["given"];
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
IMod
|
|
93
|
+
>;
|
|
94
|
+
|
|
95
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
96
|
+
|
|
97
|
+
export type IBaseTest<Shape = any, II = Shape> = {
|
|
98
|
+
iinput: II;
|
|
99
|
+
isubject: Shape;
|
|
100
|
+
istore: Shape;
|
|
101
|
+
iselection: Shape;
|
|
102
|
+
// iinitial;
|
|
103
|
+
|
|
104
|
+
given;
|
|
105
|
+
when;
|
|
106
|
+
then;
|
|
107
|
+
|
|
108
|
+
suites: Record<string, any>;
|
|
109
|
+
givens: Record<string, any>;
|
|
110
|
+
whens: Record<string, any>;
|
|
111
|
+
thens: Record<string, any>;
|
|
112
|
+
checks: Record<string, any>;
|
|
12
113
|
};
|
|
13
114
|
|
|
14
|
-
export type
|
|
115
|
+
// export type ITTestShape = {
|
|
15
116
|
|
|
16
|
-
|
|
17
|
-
string,
|
|
18
|
-
IRunTime,
|
|
19
|
-
ITestTypes[]
|
|
20
|
-
];
|
|
117
|
+
// };
|
package/src/Web.ts
CHANGED
|
@@ -1,241 +1,116 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IBaseTest,
|
|
3
|
+
ITestImplementation,
|
|
4
|
+
ITestSpecification,
|
|
5
|
+
} from "./Types";
|
|
6
|
+
import Testeranto from "./lib/core.js";
|
|
1
7
|
import {
|
|
2
8
|
ITTestResourceConfiguration,
|
|
3
9
|
ITTestResourceRequest,
|
|
4
|
-
ITTestShape,
|
|
5
|
-
ITestArtificer,
|
|
6
10
|
ITestJob,
|
|
7
|
-
ITestSpecification,
|
|
8
11
|
defaultTestResourceRequirement,
|
|
9
|
-
} from "./
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
12
|
+
} from "./lib/index.js";
|
|
13
|
+
import {
|
|
14
|
+
INodeUtils,
|
|
15
|
+
ITestInterface,
|
|
16
|
+
IWebTestInterface,
|
|
17
|
+
IWebUtils,
|
|
18
|
+
} from "./lib/types";
|
|
19
|
+
|
|
20
|
+
// const remote = require("@electron/remote");
|
|
21
|
+
// import remote from "@electron/remote";
|
|
22
|
+
// const electron = require("electron");
|
|
23
|
+
// const remote =
|
|
24
|
+
// process.type === "browser" ? electron : require("@electron/remote");
|
|
25
|
+
|
|
26
|
+
class WebTesteranto<TestShape extends IBaseTest> extends Testeranto<TestShape> {
|
|
27
|
+
constructor(
|
|
28
|
+
input: TestShape["iinput"],
|
|
29
|
+
testSpecification: ITestSpecification<TestShape>,
|
|
30
|
+
testImplementation: ITestImplementation<TestShape>,
|
|
31
|
+
testResourceRequirement: ITTestResourceRequest,
|
|
32
|
+
testInterface: Partial<ITestInterface<TestShape>>
|
|
33
|
+
) {
|
|
34
|
+
super(
|
|
35
|
+
input,
|
|
36
|
+
testSpecification,
|
|
37
|
+
testImplementation,
|
|
38
|
+
testResourceRequirement,
|
|
39
|
+
(window as any).NodeWriter,
|
|
40
|
+
testInterface
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const testResourceArg = decodeURIComponent(
|
|
44
|
+
new URLSearchParams(location.search).get("requesting") || ""
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const partialTestResource = JSON.parse(
|
|
49
|
+
testResourceArg
|
|
50
|
+
) as ITTestResourceConfiguration;
|
|
51
|
+
|
|
52
|
+
this.receiveTestResourceConfig(this.testJobs[0], partialTestResource);
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.error(e);
|
|
55
|
+
// process.exit(-1);
|
|
56
|
+
}
|
|
39
57
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
const requesting = new URLSearchParams(location.search).get("requesting");
|
|
59
|
+
if (requesting) {
|
|
60
|
+
const testResourceArg = decodeURIComponent(requesting);
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const partialTestResource = JSON.parse(
|
|
64
|
+
testResourceArg
|
|
65
|
+
) as ITTestResourceConfiguration;
|
|
66
|
+
|
|
67
|
+
console.log("initial test resource", partialTestResource);
|
|
68
|
+
this.receiveTestResourceConfig(this.testJobs[0], partialTestResource);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
console.error(e);
|
|
71
|
+
// process.exit(-1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
51
75
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
76
|
+
async receiveTestResourceConfig(
|
|
77
|
+
t: ITestJob<IWebUtils>,
|
|
78
|
+
partialTestResource: ITTestResourceConfiguration
|
|
79
|
+
) {
|
|
80
|
+
const { failed, artifacts, logPromise } = await t.receiveTestResourceConfig(
|
|
81
|
+
partialTestResource,
|
|
82
|
+
{
|
|
83
|
+
browser: await (window as any).browser,
|
|
84
|
+
ipc: (window as any).ipcRenderer,
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
console.log("test is done, awaiting test result write to fs");
|
|
89
|
+
Promise.all([...artifacts, logPromise]).then(async () => {
|
|
90
|
+
// we can't close the window becuase we might be taking a screenshot
|
|
91
|
+
// window.close();
|
|
92
|
+
// console.log(
|
|
93
|
+
// "(window as any).browser",
|
|
94
|
+
// JSON.stringify(await (window as any).browser)
|
|
95
|
+
// );
|
|
96
|
+
// var currentWindow = (await (window as any).browser).getCurrentWindow();
|
|
97
|
+
// currentWindow.close();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
56
100
|
}
|
|
57
101
|
|
|
58
|
-
export default async <
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ISelection,
|
|
64
|
-
WhenShape,
|
|
65
|
-
IThenShape,
|
|
66
|
-
IState
|
|
67
|
-
>(
|
|
68
|
-
input: IInput,
|
|
69
|
-
testSpecification: ITestSpecification<
|
|
70
|
-
TestShape,
|
|
71
|
-
ISubject,
|
|
72
|
-
IStore,
|
|
73
|
-
ISelection,
|
|
74
|
-
IThenShape
|
|
75
|
-
>,
|
|
76
|
-
testImplementation,
|
|
77
|
-
testInterface: {
|
|
78
|
-
actionHandler?: (b: (...any) => any) => any;
|
|
79
|
-
andWhen: (
|
|
80
|
-
store: IStore,
|
|
81
|
-
actioner,
|
|
82
|
-
testResource: ITTestResourceConfiguration
|
|
83
|
-
) => Promise<ISelection>;
|
|
84
|
-
butThen?: (
|
|
85
|
-
store: IStore,
|
|
86
|
-
callback,
|
|
87
|
-
testResource: ITTestResourceConfiguration
|
|
88
|
-
) => Promise<ISelection>;
|
|
89
|
-
assertioner?: (t: IThenShape) => any;
|
|
90
|
-
|
|
91
|
-
afterAll?: (store: IStore, artificer: ITestArtificer) => any;
|
|
92
|
-
afterEach?: (
|
|
93
|
-
store: IStore,
|
|
94
|
-
key: string,
|
|
95
|
-
artificer: ITestArtificer
|
|
96
|
-
) => Promise<unknown>;
|
|
97
|
-
beforeAll?: (input: IInput, artificer: ITestArtificer) => Promise<ISubject>;
|
|
98
|
-
beforeEach?: (
|
|
99
|
-
subject: ISubject,
|
|
100
|
-
initialValues,
|
|
101
|
-
testResource: ITTestResourceConfiguration,
|
|
102
|
-
artificer: ITestArtificer
|
|
103
|
-
) => Promise<IStore>;
|
|
104
|
-
},
|
|
102
|
+
export default async <ITestShape extends IBaseTest>(
|
|
103
|
+
input: ITestShape["iinput"],
|
|
104
|
+
testSpecification: ITestSpecification<ITestShape>,
|
|
105
|
+
testImplementation: ITestImplementation<ITestShape>,
|
|
106
|
+
testInterface: Partial<IWebTestInterface<ITestShape>>,
|
|
105
107
|
testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement
|
|
106
|
-
) => {
|
|
107
|
-
|
|
108
|
-
console.log("web NodeWriter", (window as any).NodeWriter);
|
|
109
|
-
|
|
110
|
-
const mrt = new TesterantoLevelTwo(
|
|
108
|
+
): Promise<Testeranto<ITestShape>> => {
|
|
109
|
+
return new WebTesteranto<ITestShape>(
|
|
111
110
|
input,
|
|
112
111
|
testSpecification,
|
|
113
112
|
testImplementation,
|
|
114
|
-
testInterface,
|
|
115
113
|
testResourceRequirement,
|
|
116
|
-
testInterface
|
|
117
|
-
testInterface.beforeEach ||
|
|
118
|
-
async function (subject: any, initialValues: any, testResource: any) {
|
|
119
|
-
return subject as any;
|
|
120
|
-
},
|
|
121
|
-
testInterface.afterEach || (async (s) => s),
|
|
122
|
-
testInterface.afterAll || ((store: IStore) => undefined),
|
|
123
|
-
testInterface.butThen || (async (a) => a as any),
|
|
124
|
-
testInterface.andWhen,
|
|
125
|
-
testInterface.actionHandler ||
|
|
126
|
-
function (b: (...any: any[]) => any) {
|
|
127
|
-
return b;
|
|
128
|
-
},
|
|
129
|
-
(window as any).NodeWriter
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
const tl2: TesterantoLevelTwo<any, any, any, any, any, any, any, any> = mrt;
|
|
133
|
-
const t: ITestJob = tl2.testJobs[0];
|
|
134
|
-
const testResourceArg = decodeURIComponent(
|
|
135
|
-
new URLSearchParams(location.search).get('requesting') || ''
|
|
114
|
+
testInterface
|
|
136
115
|
);
|
|
137
|
-
|
|
138
|
-
try {
|
|
139
|
-
const partialTestResource = JSON.parse(
|
|
140
|
-
testResourceArg
|
|
141
|
-
) as ITTestResourceConfiguration;
|
|
142
|
-
|
|
143
|
-
console.log("initial test resource", partialTestResource);
|
|
144
|
-
|
|
145
|
-
if (partialTestResource.scheduled) {
|
|
146
|
-
console.log("test is scheduled");
|
|
147
|
-
|
|
148
|
-
console.log("awaiting test resources via WS...");
|
|
149
|
-
webSocket.addEventListener("open", (event) => {
|
|
150
|
-
webSocket.addEventListener("message", (event) => {
|
|
151
|
-
console.log("Message from server ", event.data);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
const r = JSON.stringify({
|
|
155
|
-
type: "testeranto:hola",
|
|
156
|
-
data: {
|
|
157
|
-
requirement: {
|
|
158
|
-
...testResourceRequirement,
|
|
159
|
-
name: partialTestResource.name
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
webSocket.send(r);
|
|
165
|
-
|
|
166
|
-
console.log("awaiting test resources via websocket...", r);
|
|
167
|
-
webSocket.onmessage = (
|
|
168
|
-
async (msg: MessageEvent<any>) => {
|
|
169
|
-
console.log("message: ", msg);
|
|
170
|
-
|
|
171
|
-
const resourcesFromWs = JSON.parse(msg.data);
|
|
172
|
-
console.log("secondary test resource", resourcesFromWs);
|
|
173
|
-
|
|
174
|
-
const secondTestResource = {
|
|
175
|
-
fs: ".",
|
|
176
|
-
...JSON.parse(JSON.stringify(partialTestResource)),
|
|
177
|
-
...JSON.parse(JSON.stringify(resourcesFromWs)),
|
|
178
|
-
} as ITTestResourceConfiguration;
|
|
179
|
-
|
|
180
|
-
console.log("final test resource", secondTestResource);
|
|
181
|
-
receiveTestResourceConfigScheduled(t, secondTestResource);
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
});
|
|
185
|
-
} else {
|
|
186
|
-
receiveTestResourceConfigUnscheduled(t, partialTestResource);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// const partialTestResource = JSON.parse(
|
|
190
|
-
// testResourceArg
|
|
191
|
-
// ) as ITTestResourceConfiguration;
|
|
192
|
-
|
|
193
|
-
// if (partialTestResource.fs && partialTestResource.ports) {
|
|
194
|
-
// receiveTestResourceConfig(t, partialTestResource);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// } else {
|
|
198
|
-
// console.log("test configuration is incomplete", partialTestResource);
|
|
199
|
-
// console.log(
|
|
200
|
-
// "requesting test resources via ws",
|
|
201
|
-
// testResourceRequirement
|
|
202
|
-
// );
|
|
203
|
-
|
|
204
|
-
// webSocket.addEventListener("open", (event) => {
|
|
205
|
-
// webSocket.addEventListener("message", (event) => {
|
|
206
|
-
// console.log("Message from server ", event.data);
|
|
207
|
-
// });
|
|
208
|
-
|
|
209
|
-
// const r = JSON.stringify({
|
|
210
|
-
// type: "testeranto:hola",
|
|
211
|
-
// data: {
|
|
212
|
-
// testResourceRequirement,
|
|
213
|
-
// },
|
|
214
|
-
// });
|
|
215
|
-
|
|
216
|
-
// webSocket.send(r);
|
|
217
|
-
|
|
218
|
-
// console.log("awaiting test resources via websocket...", r);
|
|
219
|
-
// webSocket.onmessage = (
|
|
220
|
-
// async (msg: MessageEvent<any>) => {
|
|
221
|
-
// console.log("message: ", msg);
|
|
222
|
-
|
|
223
|
-
// const resourcesFromPm2 = msg.data.testResourceConfiguration;
|
|
224
|
-
// const secondTestResource = {
|
|
225
|
-
// fs: ".",
|
|
226
|
-
// ...JSON.parse(JSON.stringify(partialTestResource)),
|
|
227
|
-
// ...JSON.parse(JSON.stringify(resourcesFromPm2)),
|
|
228
|
-
// } as ITTestResourceConfiguration;
|
|
229
|
-
|
|
230
|
-
// console.log("secondTestResource", secondTestResource);
|
|
231
|
-
// receiveTestResourceConfig(t, secondTestResource);
|
|
232
|
-
// }
|
|
233
|
-
// );
|
|
234
|
-
// });
|
|
235
|
-
// }
|
|
236
|
-
|
|
237
|
-
} catch (e) {
|
|
238
|
-
console.error(e);
|
|
239
|
-
// process.exit(-1);
|
|
240
|
-
}
|
|
241
116
|
};
|
package/src/cjs-shim.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import url from 'node:url';
|
|
4
|
+
|
|
5
|
+
// globalThis.require = createRequire(import.meta.url);
|
|
6
|
+
globalThis.__filename = url.fileURLToPath(import.meta.url);
|
|
7
|
+
globalThis.__dirname = path.dirname(__filename);
|
|
8
|
+
|
|
9
|
+
// const p = `${import.meta.url}/..`;
|
|
10
|
+
// globalThis.require = createRequire(`${import.meta.url}/..`);
|
|
11
|
+
// globalThis.__filename = url.fileURLToPath(`${import.meta.url}/..`);
|
|
12
|
+
// globalThis.__dirname = path.dirname(`${__filename}/..`);
|