testeranto 0.49.9 → 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 +6 -27
- 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 +5 -26
- 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 → SubPackages}/react-dom/jsx/index.d.ts +3 -3
- 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 +3 -5
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +19 -62
- 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 -146
- 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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IBaseTest } from "../../../Types";
|
|
2
|
+
import test from "../../../Web";
|
|
3
|
+
import { ITestImpl, ITestSpec } from "../../react/jsx";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
testInterface, IInput
|
|
7
|
+
} from "./index";
|
|
8
|
+
|
|
9
|
+
export default <ITestShape extends IBaseTest>(
|
|
10
|
+
testImplementations: ITestImpl<ITestShape>,
|
|
11
|
+
testSpecifications: ITestSpec<ITestShape>,
|
|
12
|
+
testInput: IInput
|
|
13
|
+
) => {
|
|
14
|
+
return test<
|
|
15
|
+
ITestShape
|
|
16
|
+
>(
|
|
17
|
+
testInput,
|
|
18
|
+
testSpecifications,
|
|
19
|
+
testImplementations,
|
|
20
|
+
testInterface,
|
|
21
|
+
)
|
|
22
|
+
};
|
package/src/Types.ts
CHANGED
|
@@ -1,16 +1,147 @@
|
|
|
1
|
+
import { BrowserWindow } from "electron";
|
|
2
|
+
import { Page, Browser, ScreenshotOptions } from "puppeteer-core";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ITTestResourceConfiguration,
|
|
6
|
+
ITTestResourceRequest,
|
|
7
|
+
ITestArtificer,
|
|
8
|
+
ITestCheckCallback
|
|
9
|
+
} from "./lib/index.js";
|
|
10
|
+
import { IGivens, BaseCheck, BaseSuite, BaseWhen, BaseThen, BaseGiven } from "./lib/abstractBase.js";
|
|
11
|
+
import Testeranto from "./lib/core.js";
|
|
12
|
+
|
|
13
|
+
export type IBuiltConfig = {
|
|
14
|
+
buildDir: string,
|
|
15
|
+
modules: {
|
|
16
|
+
module: unknown,
|
|
17
|
+
test: string,
|
|
18
|
+
runtime: IRunTime
|
|
19
|
+
}[]
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type INodeUtils = TBrowser;
|
|
23
|
+
export type IWebUtils = BrowserWindow;
|
|
24
|
+
export type IUtils = INodeUtils | IWebUtils;
|
|
25
|
+
|
|
26
|
+
export type ISuiteKlasser<ITestShape extends IBaseTest> = (
|
|
27
|
+
name: string,
|
|
28
|
+
index: number,
|
|
29
|
+
givens: IGivens<ITestShape>,
|
|
30
|
+
checks: BaseCheck<ITestShape>[]
|
|
31
|
+
) => BaseSuite<ITestShape>;
|
|
32
|
+
|
|
33
|
+
export type IGivenKlasser<ITestShape extends IBaseTest> = (
|
|
34
|
+
name,
|
|
35
|
+
features,
|
|
36
|
+
whens,
|
|
37
|
+
thens,
|
|
38
|
+
givenCB
|
|
39
|
+
) => BaseGiven<ITestShape>;
|
|
40
|
+
|
|
41
|
+
export type IWhenKlasser<ITestShape extends IBaseTest> = (s, o) =>
|
|
42
|
+
BaseWhen<ITestShape>
|
|
43
|
+
|
|
44
|
+
export type IThenKlasser<ITestShape extends IBaseTest> = (s, o) =>
|
|
45
|
+
BaseThen<ITestShape>;
|
|
46
|
+
|
|
47
|
+
export type ICheckKlasser<ITestShape extends IBaseTest> = (
|
|
48
|
+
n,
|
|
49
|
+
f,
|
|
50
|
+
cb,
|
|
51
|
+
w,
|
|
52
|
+
t
|
|
53
|
+
) => BaseCheck<ITestShape>;
|
|
54
|
+
|
|
55
|
+
// export class TPage extends Page {
|
|
56
|
+
// // screenshot(options?: puppeteer.ScreenshotOptions) {
|
|
57
|
+
// // return super.screenshot({
|
|
58
|
+
// // ...options,
|
|
59
|
+
// // path: "dist/" + (options ? options : { path: "" }).path,
|
|
60
|
+
|
|
61
|
+
// // });
|
|
62
|
+
// // }
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
export class TBrowser {
|
|
66
|
+
browser: Browser;
|
|
67
|
+
constructor(browser: Browser) {
|
|
68
|
+
this.browser = browser;
|
|
69
|
+
}
|
|
70
|
+
pages(): Promise<Page[]> {
|
|
71
|
+
|
|
72
|
+
return new Promise(async (res, rej) => {
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
res(
|
|
76
|
+
(await this.browser.pages()).map((p) => {
|
|
77
|
+
// const handler = {
|
|
78
|
+
// apply: function (target, thisArg, argumentsList) {
|
|
79
|
+
// console.log('screenshot was called with ' + JSON.stringify(argumentsList));
|
|
80
|
+
// const x: ScreenshotOptions = argumentsList[0]
|
|
81
|
+
// x.path = "./dist/" + x.path;
|
|
82
|
+
// console.log('x.path' + x.path, target, thisArg);
|
|
83
|
+
// return target(...argumentsList);
|
|
84
|
+
// }
|
|
85
|
+
// };
|
|
86
|
+
// p.screenshot = new Proxy(p.screenshot, handler);
|
|
87
|
+
return p;
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
// pages(): Promise<TPage[]> {
|
|
94
|
+
// return super.pages();
|
|
95
|
+
// }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type ITTestShape = {
|
|
99
|
+
suites;
|
|
100
|
+
givens;
|
|
101
|
+
whens;
|
|
102
|
+
thens;
|
|
103
|
+
checks;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type IJsonConfig = {
|
|
107
|
+
outdir: string,
|
|
108
|
+
tests: ITestTypes[]
|
|
109
|
+
features: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
1
112
|
export type IBaseConfig = {
|
|
113
|
+
outdir: string,
|
|
114
|
+
tests: ITestTypes[]
|
|
115
|
+
features: string
|
|
116
|
+
externals: string[],
|
|
2
117
|
clearScreen: boolean;
|
|
3
118
|
devMode: boolean;
|
|
4
|
-
features: string;
|
|
5
119
|
webPlugins: any[];
|
|
6
120
|
nodePlugins: any[];
|
|
7
121
|
minify: boolean;
|
|
8
122
|
outbase: string;
|
|
9
|
-
outdir: string;
|
|
10
123
|
ports: string[];
|
|
11
|
-
|
|
124
|
+
debugger: boolean;
|
|
12
125
|
};
|
|
13
126
|
|
|
127
|
+
export type IPartialInterface<I extends IBaseTest> = Partial<ITestInterface<I>>;
|
|
128
|
+
export type IPartialNodeInterface<I extends IBaseTest> = Partial<INodeTestInterface<I>>;
|
|
129
|
+
|
|
130
|
+
export type IEntry<ITestShape extends IBaseTest> = (
|
|
131
|
+
input: ITestShape['iinput'],
|
|
132
|
+
testSpecification: ITestSpecification<ITestShape>,
|
|
133
|
+
testImplementation: ITestImplementation<ITestShape, object>,
|
|
134
|
+
testInterface: IPartialInterface<ITestShape>,
|
|
135
|
+
testResourceRequirement: ITTestResourceRequest,
|
|
136
|
+
) => Promise<Testeranto<ITestShape>>;
|
|
137
|
+
|
|
138
|
+
// type If = {
|
|
139
|
+
// (modulePath: string | URL, options?: childProcess.ForkOptions): childProcess.ChildProcess;
|
|
140
|
+
// (modulePath: string | URL, args?: readonly string[], options?: childProcess.ForkOptions): childProcess.ChildProcess
|
|
141
|
+
// };
|
|
142
|
+
|
|
143
|
+
// const f: If = childProcess.fork;
|
|
144
|
+
|
|
14
145
|
export type IRunTime = `node` | `web`;
|
|
15
146
|
|
|
16
147
|
export type ITestTypes = [
|
|
@@ -18,3 +149,203 @@ export type ITestTypes = [
|
|
|
18
149
|
IRunTime,
|
|
19
150
|
ITestTypes[]
|
|
20
151
|
];
|
|
152
|
+
|
|
153
|
+
export type ITestSpecification<
|
|
154
|
+
ITestShape extends IBaseTest
|
|
155
|
+
> = (
|
|
156
|
+
Suite: {
|
|
157
|
+
[K in keyof ITestShape["suites"]]: (
|
|
158
|
+
name: string,
|
|
159
|
+
givens: IGivens<
|
|
160
|
+
ITestShape
|
|
161
|
+
>,
|
|
162
|
+
checks: BaseCheck<
|
|
163
|
+
ITestShape
|
|
164
|
+
>[]
|
|
165
|
+
) => BaseSuite<
|
|
166
|
+
ITestShape
|
|
167
|
+
>;
|
|
168
|
+
},
|
|
169
|
+
Given: {
|
|
170
|
+
[K in keyof ITestShape["givens"]]: (
|
|
171
|
+
features: string[],
|
|
172
|
+
whens: BaseWhen<
|
|
173
|
+
ITestShape
|
|
174
|
+
>[],
|
|
175
|
+
thens: BaseThen<
|
|
176
|
+
ITestShape
|
|
177
|
+
>[],
|
|
178
|
+
...xtrasB: ITestShape["givens"][K]
|
|
179
|
+
) => BaseGiven<
|
|
180
|
+
ITestShape
|
|
181
|
+
>;
|
|
182
|
+
},
|
|
183
|
+
When: {
|
|
184
|
+
[K in keyof ITestShape["whens"]]: (
|
|
185
|
+
...xtrasC: ITestShape["whens"][K]
|
|
186
|
+
) => BaseWhen<
|
|
187
|
+
ITestShape
|
|
188
|
+
>;
|
|
189
|
+
},
|
|
190
|
+
Then: {
|
|
191
|
+
[K in keyof ITestShape["thens"]]: (
|
|
192
|
+
...xtrasD: ITestShape["thens"][K]
|
|
193
|
+
) => BaseThen<
|
|
194
|
+
ITestShape
|
|
195
|
+
>;
|
|
196
|
+
},
|
|
197
|
+
Check: ITestCheckCallback<ITestShape>
|
|
198
|
+
) => any[];
|
|
199
|
+
|
|
200
|
+
export type ITestImplementation<
|
|
201
|
+
ITestShape extends IBaseTest,
|
|
202
|
+
IMod
|
|
203
|
+
> = Modify<{
|
|
204
|
+
suites: {
|
|
205
|
+
[K in keyof ITestShape["suites"]]: string;
|
|
206
|
+
};
|
|
207
|
+
givens: {
|
|
208
|
+
[K in keyof ITestShape["givens"]]: (
|
|
209
|
+
...Ig: ITestShape["givens"][K]
|
|
210
|
+
) => ITestShape['given'];
|
|
211
|
+
};
|
|
212
|
+
whens: {
|
|
213
|
+
[K in keyof ITestShape["whens"]]: (
|
|
214
|
+
...Iw: ITestShape["whens"][K]
|
|
215
|
+
) =>
|
|
216
|
+
(zel: ITestShape['iselection']) =>
|
|
217
|
+
ITestShape['when'];
|
|
218
|
+
};
|
|
219
|
+
thens: {
|
|
220
|
+
[K in keyof ITestShape["thens"]]: (
|
|
221
|
+
...It: ITestShape["thens"][K]
|
|
222
|
+
) => (ssel: ITestShape['iselection']) =>
|
|
223
|
+
ITestShape['then'];
|
|
224
|
+
};
|
|
225
|
+
checks: {
|
|
226
|
+
[K in keyof ITestShape["checks"]]: (
|
|
227
|
+
...Ic: ITestShape["checks"][K]
|
|
228
|
+
) => ITestShape['given'];
|
|
229
|
+
};
|
|
230
|
+
}, IMod>;
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
export type ITestInterface<
|
|
235
|
+
ITestShape extends IBaseTest
|
|
236
|
+
> = {
|
|
237
|
+
assertThis: (x: ITestShape['then']) => void,
|
|
238
|
+
|
|
239
|
+
andWhen: (
|
|
240
|
+
store: ITestShape['istore'],
|
|
241
|
+
whenCB: ITestShape['when'],
|
|
242
|
+
testResource: ITTestResourceConfiguration
|
|
243
|
+
) => Promise<ITestShape['istore']>;
|
|
244
|
+
butThen: (
|
|
245
|
+
store: ITestShape['istore'],
|
|
246
|
+
thenCB,
|
|
247
|
+
testResource: ITTestResourceConfiguration
|
|
248
|
+
) => Promise<ITestShape['iselection']>;
|
|
249
|
+
|
|
250
|
+
afterAll: (
|
|
251
|
+
store: ITestShape['istore'],
|
|
252
|
+
artificer: ITestArtificer,
|
|
253
|
+
utils: IUtils
|
|
254
|
+
) => any;
|
|
255
|
+
afterEach: (
|
|
256
|
+
store: ITestShape['istore'],
|
|
257
|
+
key: string,
|
|
258
|
+
artificer: ITestArtificer,
|
|
259
|
+
// utils: IUtils
|
|
260
|
+
) => Promise<unknown>;
|
|
261
|
+
beforeAll: (
|
|
262
|
+
input: ITestShape['iinput'],
|
|
263
|
+
testResource: ITTestResourceConfiguration,
|
|
264
|
+
artificer: ITestArtificer,
|
|
265
|
+
// utils: IUtils
|
|
266
|
+
) => Promise<ITestShape['isubject']>;
|
|
267
|
+
beforeEach: (
|
|
268
|
+
subject: ITestShape['isubject'],
|
|
269
|
+
initializer: (c?) => ITestShape['given'],
|
|
270
|
+
artificer: ITestArtificer,
|
|
271
|
+
testResource: ITTestResourceConfiguration,
|
|
272
|
+
initialValues,
|
|
273
|
+
// utils: IUtils
|
|
274
|
+
) => Promise<ITestShape['istore']>;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export type INodeTestInterface<
|
|
278
|
+
ITestShape extends IBaseTest
|
|
279
|
+
> = {
|
|
280
|
+
assertThis: (x: ITestShape['then']) => void,
|
|
281
|
+
|
|
282
|
+
andWhen: (
|
|
283
|
+
store: ITestShape['istore'],
|
|
284
|
+
whenCB: ITestShape['when'],
|
|
285
|
+
testResource: ITTestResourceConfiguration
|
|
286
|
+
) => Promise<ITestShape['istore']>;
|
|
287
|
+
butThen: (
|
|
288
|
+
store: ITestShape['istore'],
|
|
289
|
+
thenCB,
|
|
290
|
+
testResource: ITTestResourceConfiguration
|
|
291
|
+
) => Promise<ITestShape['iselection']>;
|
|
292
|
+
|
|
293
|
+
afterAll: (
|
|
294
|
+
store: ITestShape['istore'],
|
|
295
|
+
artificer: ITestArtificer,
|
|
296
|
+
browser: INodeUtils
|
|
297
|
+
) => any;
|
|
298
|
+
afterEach: (
|
|
299
|
+
store: ITestShape['istore'],
|
|
300
|
+
key: string,
|
|
301
|
+
artificer: ITestArtificer,
|
|
302
|
+
// utils: IUtils
|
|
303
|
+
) => Promise<unknown>;
|
|
304
|
+
beforeAll: (
|
|
305
|
+
input: ITestShape['iinput'],
|
|
306
|
+
testResource: ITTestResourceConfiguration,
|
|
307
|
+
artificer: ITestArtificer,
|
|
308
|
+
// utils: IUtils
|
|
309
|
+
) => Promise<ITestShape['isubject']>;
|
|
310
|
+
beforeEach: (
|
|
311
|
+
subject: ITestShape['isubject'],
|
|
312
|
+
initializer: (c?) => ITestShape['given'],
|
|
313
|
+
artificer: ITestArtificer,
|
|
314
|
+
testResource: ITTestResourceConfiguration,
|
|
315
|
+
initialValues,
|
|
316
|
+
// utils: IUtils
|
|
317
|
+
) => Promise<ITestShape['istore']>;
|
|
318
|
+
} & ITestInterface<ITestShape>;
|
|
319
|
+
|
|
320
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
321
|
+
|
|
322
|
+
export type IBaseTest = {
|
|
323
|
+
iinput; // input
|
|
324
|
+
isubject; // subject
|
|
325
|
+
istore; // store
|
|
326
|
+
iselection;
|
|
327
|
+
// iinitial;
|
|
328
|
+
|
|
329
|
+
given;
|
|
330
|
+
when;
|
|
331
|
+
then;
|
|
332
|
+
suites: Record<string, any[]>;
|
|
333
|
+
givens: Record<string, any[]>;
|
|
334
|
+
whens: Record<string, any[]>;
|
|
335
|
+
thens: Record<string, any[]>;
|
|
336
|
+
checks: Record<string, any[]>;
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export type ITestShaper<
|
|
340
|
+
T extends IBaseTest,
|
|
341
|
+
modifier
|
|
342
|
+
> = {
|
|
343
|
+
given;
|
|
344
|
+
when;
|
|
345
|
+
then;
|
|
346
|
+
suites;
|
|
347
|
+
givens;
|
|
348
|
+
whens;
|
|
349
|
+
thens;
|
|
350
|
+
checks;
|
|
351
|
+
};
|