testeranto 0.62.0 → 0.73.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/README.md +38 -26
- package/dist/cjs-shim.js +2 -2
- package/dist/common/Node.js +14 -51
- package/dist/common/PM/index.js +71 -0
- package/dist/common/PM/main.js +361 -0
- package/dist/common/PM/node.js +176 -0
- package/dist/common/PM/web.js +174 -0
- package/dist/common/Project.js +121 -266
- package/dist/common/Puppeteer.js +109 -0
- package/dist/common/Reporter.js +119 -0
- package/dist/common/Scheduler.js +1 -0
- package/dist/common/SubPackages/puppeteer.js +3 -1
- package/dist/common/SubPackages/react-dom/component/web.js +98 -45
- package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/common/Types.js +2 -32
- package/dist/common/Web.js +25 -37
- package/dist/common/esbuildConfigs/index.js +5 -5
- package/dist/common/esbuildConfigs/node.js +17 -15
- package/dist/common/esbuildConfigs/report.js +12 -47
- package/dist/common/esbuildConfigs/tests.js +0 -1
- package/dist/common/esbuildConfigs/web.js +17 -12
- package/dist/common/lib/abstractBase.js +190 -35
- package/dist/common/lib/basebuilder.js +56 -29
- package/dist/common/lib/classBuilder.js +8 -5
- package/dist/common/lib/core.js +42 -17
- package/dist/common/lib/index.js +11 -8
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +14 -28
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +14 -51
- package/dist/module/PM/index.js +67 -0
- package/dist/module/PM/main.js +331 -0
- package/dist/module/PM/node.js +168 -0
- package/dist/module/PM/web.js +167 -0
- package/dist/module/Project.js +122 -267
- package/dist/module/Puppeteer.js +104 -0
- package/dist/module/Reporter.js +114 -0
- package/dist/module/Scheduler.js +1 -0
- package/dist/module/SubPackages/puppeteer.js +3 -1
- package/dist/module/SubPackages/react/jsx/node.js +1 -1
- package/dist/module/SubPackages/react/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-dom/component/node.js +2 -2
- package/dist/module/SubPackages/react-dom/component/web.js +98 -45
- package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/module/Types.js +3 -30
- package/dist/module/Web.js +26 -38
- package/dist/module/esbuildConfigs/index.js +5 -5
- package/dist/module/esbuildConfigs/node.js +17 -15
- package/dist/module/esbuildConfigs/report.js +11 -48
- package/dist/module/esbuildConfigs/tests.js +0 -1
- package/dist/module/esbuildConfigs/web.js +17 -12
- package/dist/module/lib/abstractBase.js +190 -35
- package/dist/module/lib/basebuilder.js +56 -29
- package/dist/module/lib/classBuilder.js +8 -5
- package/dist/module/lib/core.js +44 -19
- package/dist/module/lib/index.js +11 -8
- package/dist/module/preload.js +15 -27
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Report.css +1616 -584
- package/dist/prebuild/Report.js +2635 -2506
- package/dist/types/Node.d.ts +3 -2
- package/dist/types/PM/index.d.ts +19 -0
- package/dist/types/PM/main.d.ts +28 -0
- package/dist/types/PM/node.d.ts +26 -0
- package/dist/types/PM/web.d.ts +24 -0
- package/dist/types/Project.d.ts +1 -2
- package/dist/types/Puppeteer.d.ts +1 -0
- package/dist/types/Reporter.d.ts +1 -0
- package/dist/types/Scheduler.d.ts +0 -0
- package/dist/types/SubPackages/puppeteer.d.ts +3 -3
- package/dist/types/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
- package/dist/types/Types.d.ts +19 -100
- package/dist/types/Web.d.ts +3 -2
- package/dist/types/esbuildConfigs/features.d.ts +1 -1
- package/dist/types/esbuildConfigs/index.d.ts +1 -1
- package/dist/types/esbuildConfigs/node.d.ts +1 -1
- package/dist/types/esbuildConfigs/report.d.ts +4 -0
- package/dist/types/esbuildConfigs/tests.d.ts +1 -1
- package/dist/types/esbuildConfigs/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +26 -24
- package/dist/types/lib/basebuilder.d.ts +10 -7
- package/dist/types/lib/classBuilder.d.ts +4 -3
- package/dist/types/lib/core.d.ts +5 -4
- package/dist/types/lib/index.d.ts +7 -5
- package/dist/types/lib/types.d.ts +62 -0
- package/dist/types/preload.d.ts +0 -1
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +6 -7
- package/src/Node.ts +30 -85
- package/src/PM/index.ts +102 -0
- package/src/PM/main.ts +420 -0
- package/src/PM/node.ts +515 -0
- package/src/PM/web.ts +497 -0
- package/src/Project.ts +183 -619
- package/src/Puppeteer.ts +131 -0
- package/src/Report.tsx +158 -44
- package/src/Reporter.ts +134 -0
- package/src/Scheduler.ts +0 -0
- package/src/SubPackages/puppeteer.ts +19 -14
- package/src/SubPackages/react/component/node.ts +20 -32
- package/src/SubPackages/react/component/web.ts +20 -30
- package/src/SubPackages/react/jsx/index.ts +13 -24
- package/src/SubPackages/react/jsx/node.ts +5 -8
- package/src/SubPackages/react/jsx/web.ts +10 -8
- package/src/SubPackages/react-dom/component/node.ts +17 -23
- package/src/SubPackages/react-dom/component/web.ts +134 -95
- package/src/SubPackages/react-dom/jsx/web.ts +41 -48
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
- package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
- package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
- package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
- package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
- package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
- package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
- package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
- package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
- package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
- package/src/Types.ts +73 -307
- package/src/Web.ts +40 -81
- package/src/cjs-shim.js +2 -2
- package/src/esbuildConfigs/features.ts +3 -4
- package/src/esbuildConfigs/index.ts +8 -8
- package/src/esbuildConfigs/node.ts +21 -20
- package/src/esbuildConfigs/report.ts +15 -51
- package/src/esbuildConfigs/tests.ts +3 -9
- package/src/esbuildConfigs/web.ts +22 -20
- package/src/lib/abstractBase.ts +312 -164
- package/src/lib/basebuilder.ts +123 -127
- package/src/lib/classBuilder.ts +30 -48
- package/src/lib/core.ts +115 -84
- package/src/lib/index.ts +58 -56
- package/src/lib/types.ts +197 -0
- package/src/preload.ts +14 -30
- package/src/puppeteerConfiger.ts +26 -0
- package/src/web.html.ts +1 -1
- package/dist/common/NodeWriter.js +0 -56
- package/dist/common/electron.js +0 -196
- package/dist/common/lib/browser.js +0 -26
- package/dist/common/nodeWriterElectron.js +0 -55
- package/dist/module/NodeWriter.js +0 -50
- package/dist/module/electron.js +0 -191
- package/dist/module/lib/browser.js +0 -22
- package/dist/module/nodeWriterElectron.js +0 -52
- package/dist/types/NodeWriter.d.ts +0 -2
- package/dist/types/lib/browser.d.ts +0 -6
- package/dist/types/nodeWriterElectron.d.ts +0 -2
- package/src/NodeWriter.ts +0 -69
- package/src/electron.ts +0 -250
- package/src/lib/browser.ts +0 -34
- package/src/nodeWriterElectron.ts +0 -71
- package/yarn-error.log +0 -3144
- /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
|
@@ -2,54 +2,42 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import Testeranto from "../../../Node.js";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
ITestImplementation,
|
|
8
|
+
ITestSpecification,
|
|
9
|
+
} from "../../../Types";
|
|
6
10
|
|
|
7
11
|
type IInput = typeof React.Component;
|
|
8
|
-
type ISelection = React.CElement<any, any
|
|
9
|
-
type IStore = React.CElement<any, any
|
|
10
|
-
type ISubject = React.CElement<any, any
|
|
12
|
+
type ISelection = React.CElement<any, any>;
|
|
13
|
+
type IStore = React.CElement<any, any>;
|
|
14
|
+
type ISubject = React.CElement<any, any>;
|
|
11
15
|
|
|
12
|
-
export type IImpl<
|
|
13
|
-
ISpec
|
|
14
|
-
|
|
15
|
-
> = ITestImplementation<
|
|
16
|
-
ISpec, object
|
|
17
|
-
>
|
|
18
|
-
|
|
19
|
-
export type ISpec<
|
|
20
|
-
T extends IBaseTest
|
|
21
|
-
> = ITestSpecification<
|
|
22
|
-
T
|
|
16
|
+
export type IImpl<ISpec extends IBaseTest, IState> = ITestImplementation<
|
|
17
|
+
ISpec,
|
|
18
|
+
object
|
|
23
19
|
>;
|
|
24
20
|
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
testImplementations: ITestImplementation<
|
|
30
|
-
ITestShape,
|
|
31
|
-
object
|
|
32
|
-
>,
|
|
21
|
+
export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
|
|
22
|
+
|
|
23
|
+
export default <ITestShape extends IBaseTest, IState>(
|
|
24
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
33
25
|
testSpecifications: ISpec<ITestShape>,
|
|
34
26
|
testInput: IInput
|
|
35
27
|
) => {
|
|
36
|
-
return Testeranto<
|
|
37
|
-
ITestShape
|
|
38
|
-
>(
|
|
28
|
+
return Testeranto<ITestShape>(
|
|
39
29
|
testInput,
|
|
40
30
|
testSpecifications,
|
|
41
31
|
testImplementations,
|
|
42
32
|
{
|
|
43
|
-
beforeEach: async (
|
|
44
|
-
): Promise<IStore> => {
|
|
33
|
+
beforeEach: async (): Promise<IStore> => {
|
|
45
34
|
return new Promise((resolve, rej) => {
|
|
46
|
-
resolve(React.createElement(testInput, {
|
|
47
|
-
}, []));
|
|
35
|
+
resolve(React.createElement(testInput, {}, []));
|
|
48
36
|
});
|
|
49
37
|
},
|
|
50
38
|
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
51
39
|
return whenCB()(s);
|
|
52
40
|
},
|
|
53
|
-
}
|
|
54
|
-
)
|
|
41
|
+
}
|
|
42
|
+
);
|
|
55
43
|
};
|
|
@@ -2,52 +2,42 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import Testeranto from "../../../Web.js";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
ITestImplementation,
|
|
8
|
+
ITestSpecification,
|
|
9
|
+
} from "../../../Types";
|
|
6
10
|
|
|
7
11
|
type IInput = typeof React.Component;
|
|
8
|
-
type ISelection = React.CElement<any, any
|
|
9
|
-
type Store = React.CElement<any, any
|
|
10
|
-
type Subject = React.CElement<any, any
|
|
12
|
+
type ISelection = React.CElement<any, any>;
|
|
13
|
+
type Store = React.CElement<any, any>;
|
|
14
|
+
// type Subject = React.CElement<any, any>;
|
|
11
15
|
|
|
12
|
-
export type IImpl<
|
|
13
|
-
ISpec
|
|
14
|
-
|
|
15
|
-
> = ITestImplementation<
|
|
16
|
-
ISpec, object
|
|
17
|
-
>
|
|
18
|
-
|
|
19
|
-
export type ISpec<
|
|
20
|
-
T extends IBaseTest
|
|
21
|
-
> = ITestSpecification<
|
|
22
|
-
T
|
|
16
|
+
export type IImpl<ISpec extends IBaseTest, IState> = ITestImplementation<
|
|
17
|
+
ISpec,
|
|
18
|
+
object
|
|
23
19
|
>;
|
|
24
20
|
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
>(
|
|
28
|
-
testImplementations: ITestImplementation<
|
|
29
|
-
ITestShape, object
|
|
30
|
-
>,
|
|
21
|
+
export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
|
|
22
|
+
|
|
23
|
+
export default <ITestShape extends IBaseTest>(
|
|
24
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
31
25
|
testSpecifications: ISpec<ITestShape>,
|
|
32
26
|
testInput: IInput
|
|
33
27
|
) => {
|
|
34
|
-
return Testeranto<
|
|
35
|
-
ITestShape
|
|
36
|
-
>(
|
|
28
|
+
return Testeranto<ITestShape>(
|
|
37
29
|
testInput,
|
|
38
30
|
testSpecifications,
|
|
39
31
|
testImplementations,
|
|
40
32
|
{
|
|
41
|
-
beforeEach: async (
|
|
42
|
-
): Promise<Store> => {
|
|
33
|
+
beforeEach: async (): Promise<Store> => {
|
|
43
34
|
return new Promise((resolve, rej) => {
|
|
44
|
-
resolve(React.createElement(testInput, {
|
|
45
|
-
}, []));
|
|
35
|
+
resolve(React.createElement(testInput, {}, []));
|
|
46
36
|
});
|
|
47
37
|
},
|
|
48
38
|
andWhen: function (s: Store, whenCB): Promise<ISelection> {
|
|
49
39
|
return whenCB()(s);
|
|
50
40
|
},
|
|
51
|
-
}
|
|
52
|
-
)
|
|
41
|
+
}
|
|
42
|
+
);
|
|
53
43
|
};
|
|
@@ -1,43 +1,32 @@
|
|
|
1
1
|
import { CElement } from "react";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
IBaseTest,
|
|
4
|
+
IBaseTest,
|
|
5
|
+
ITestImplementation,
|
|
6
|
+
ITestSpecification,
|
|
5
7
|
} from "../../../Types";
|
|
6
8
|
|
|
7
9
|
export type IWhenShape = any;
|
|
8
10
|
export type IThenShape = any;
|
|
9
11
|
export type InitialState = unknown;
|
|
10
12
|
export type IInput = () => JSX.Element;
|
|
11
|
-
export type ISelection = CElement<any, any
|
|
12
|
-
export type IStore = CElement<any, any
|
|
13
|
-
export type ISubject = CElement<any, any
|
|
13
|
+
export type ISelection = CElement<any, any>;
|
|
14
|
+
export type IStore = CElement<any, any>;
|
|
15
|
+
export type ISubject = CElement<any, any>;
|
|
14
16
|
|
|
15
|
-
export type ITestImpl<
|
|
16
|
-
ITestShape
|
|
17
|
-
> = ITestImplementation<
|
|
18
|
-
ITestShape, object
|
|
19
|
-
>
|
|
17
|
+
export type ITestImpl<ITestShape extends IBaseTest> =
|
|
18
|
+
ITestImplementation<ITestShape>;
|
|
20
19
|
|
|
21
|
-
export type ITestSpec<
|
|
22
|
-
ITestShape
|
|
23
|
-
> = ITestSpecification<
|
|
24
|
-
ITestShape
|
|
25
|
-
>
|
|
20
|
+
export type ITestSpec<ITestShape extends IBaseTest> =
|
|
21
|
+
ITestSpecification<ITestShape>;
|
|
26
22
|
|
|
27
23
|
export const testInterface = {
|
|
28
|
-
|
|
29
|
-
beforeEach: async (
|
|
30
|
-
x,
|
|
31
|
-
ndx,
|
|
32
|
-
testRsource,
|
|
33
|
-
artificer
|
|
34
|
-
): Promise<IStore> => {
|
|
24
|
+
beforeEach: async (x, ndx, testRsource, artificer): Promise<IStore> => {
|
|
35
25
|
return new Promise((resolve, rej) => {
|
|
36
|
-
resolve(x())
|
|
26
|
+
resolve(x());
|
|
37
27
|
});
|
|
38
28
|
},
|
|
39
29
|
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
40
30
|
return whenCB(s);
|
|
41
31
|
},
|
|
42
|
-
|
|
43
|
-
}
|
|
32
|
+
};
|
|
@@ -5,25 +5,22 @@ import {
|
|
|
5
5
|
ITestImpl,
|
|
6
6
|
ITestSpec,
|
|
7
7
|
IInput,
|
|
8
|
-
|
|
9
|
-
testInterface as baseInterface
|
|
8
|
+
testInterface as baseInterface,
|
|
10
9
|
} from "./index.js";
|
|
11
10
|
|
|
12
11
|
export default <ITestShape extends IBaseTest>(
|
|
13
12
|
testImplementations: ITestImpl<ITestShape>,
|
|
14
13
|
testSpecifications: ITestSpec<ITestShape>,
|
|
15
14
|
testInput: IInput,
|
|
16
|
-
testInterface: IPartialInterface<ITestShape
|
|
15
|
+
testInterface: IPartialInterface<ITestShape>
|
|
17
16
|
) => {
|
|
18
|
-
return Testeranto<
|
|
19
|
-
ITestShape
|
|
20
|
-
>(
|
|
17
|
+
return Testeranto<ITestShape>(
|
|
21
18
|
testInput,
|
|
22
19
|
testSpecifications,
|
|
23
20
|
testImplementations,
|
|
24
21
|
{
|
|
25
22
|
...baseInterface,
|
|
26
|
-
...testInterface
|
|
23
|
+
...testInterface,
|
|
27
24
|
}
|
|
28
|
-
)
|
|
25
|
+
);
|
|
29
26
|
};
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IBaseTest,
|
|
3
|
+
IPartialInterface,
|
|
4
|
+
IPartialWebInterface,
|
|
5
|
+
} from "../../../Types";
|
|
2
6
|
import Testeranto from "../../../Web.js";
|
|
3
7
|
|
|
4
8
|
import {
|
|
5
9
|
ITestImpl,
|
|
6
10
|
ITestSpec,
|
|
7
11
|
IInput,
|
|
8
|
-
testInterface as baseInterface
|
|
12
|
+
testInterface as baseInterface,
|
|
9
13
|
} from "./index.js";
|
|
10
14
|
|
|
11
15
|
export default <ITestShape extends IBaseTest>(
|
|
12
16
|
testImplementations: ITestImpl<ITestShape>,
|
|
13
17
|
testSpecifications: ITestSpec<ITestShape>,
|
|
14
18
|
testInput: IInput,
|
|
15
|
-
testInterface:
|
|
19
|
+
testInterface: IPartialWebInterface<ITestShape>
|
|
16
20
|
) => {
|
|
17
|
-
return Testeranto<
|
|
18
|
-
ITestShape
|
|
19
|
-
>(
|
|
21
|
+
return Testeranto<ITestShape>(
|
|
20
22
|
testInput,
|
|
21
23
|
testSpecifications,
|
|
22
24
|
testImplementations,
|
|
23
25
|
{
|
|
24
26
|
...baseInterface,
|
|
25
|
-
...testInterface
|
|
27
|
+
...testInterface,
|
|
26
28
|
}
|
|
27
|
-
)
|
|
29
|
+
);
|
|
28
30
|
};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import React, { ReactNode, createElement } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
renderToStaticMarkup,
|
|
4
|
+
renderToStaticNodeStream,
|
|
5
|
+
} from "react-dom/server";
|
|
6
|
+
import Stream from "stream";
|
|
4
7
|
|
|
5
8
|
import Testeranto from "../../../Node.js";
|
|
6
9
|
|
|
7
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
IBaseTest,
|
|
12
|
+
ITestImplementation,
|
|
13
|
+
ITestSpecification,
|
|
14
|
+
} from "../../../Types";
|
|
8
15
|
|
|
9
16
|
type IInput = typeof React.Component;
|
|
10
17
|
type InitialState = unknown;
|
|
@@ -14,22 +21,14 @@ export type ISelection = ReactNode;
|
|
|
14
21
|
export type IStore = ReactNode;
|
|
15
22
|
export type ISubject = ReactNode;
|
|
16
23
|
|
|
17
|
-
export {
|
|
18
|
-
renderToStaticMarkup, renderToStaticNodeStream, Stream
|
|
19
|
-
}
|
|
24
|
+
export { renderToStaticMarkup, renderToStaticNodeStream, Stream };
|
|
20
25
|
|
|
21
26
|
export default <ITestShape extends IBaseTest>(
|
|
22
|
-
testImplementations: ITestImplementation<
|
|
23
|
-
|
|
24
|
-
>,
|
|
25
|
-
testSpecifications: ITestSpecification<
|
|
26
|
-
ITestShape
|
|
27
|
-
>,
|
|
27
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
28
|
+
testSpecifications: ITestSpecification<ITestShape>,
|
|
28
29
|
testInput: IInput
|
|
29
30
|
) => {
|
|
30
|
-
return Testeranto<
|
|
31
|
-
ITestShape
|
|
32
|
-
>(
|
|
31
|
+
return Testeranto<ITestShape>(
|
|
33
32
|
testInput,
|
|
34
33
|
testSpecifications,
|
|
35
34
|
testImplementations,
|
|
@@ -64,21 +63,16 @@ export default <ITestShape extends IBaseTest>(
|
|
|
64
63
|
butThen: async function (s: IStore): Promise<ISelection> {
|
|
65
64
|
return s;
|
|
66
65
|
},
|
|
67
|
-
afterEach: async function (
|
|
68
|
-
store: IStore,
|
|
69
|
-
ndx,
|
|
70
|
-
artificer
|
|
71
|
-
) {
|
|
66
|
+
afterEach: async function (store: IStore, ndx, artificer) {
|
|
72
67
|
return {};
|
|
73
68
|
},
|
|
74
69
|
afterAll: (store: IStore, artificer) => {
|
|
75
70
|
return;
|
|
76
71
|
},
|
|
77
|
-
}
|
|
78
|
-
)
|
|
72
|
+
}
|
|
73
|
+
);
|
|
79
74
|
};
|
|
80
75
|
|
|
81
|
-
|
|
82
76
|
// type IInput = typeof React.Component;
|
|
83
77
|
// type InitialState = unknown;
|
|
84
78
|
// type IWhenShape = any;
|
|
@@ -5,120 +5,159 @@ import Testeranto from "../../../Web.js";
|
|
|
5
5
|
import {
|
|
6
6
|
IBaseTest,
|
|
7
7
|
ITestImplementation,
|
|
8
|
-
ITestSpecification
|
|
8
|
+
ITestSpecification,
|
|
9
9
|
} from "../../../Types";
|
|
10
10
|
|
|
11
11
|
type IInput = typeof React.Component;
|
|
12
12
|
type InitialState = unknown;
|
|
13
13
|
type ISelection = {
|
|
14
|
-
htmlElement: HTMLElement
|
|
15
|
-
reactElement: CElement<any, any
|
|
14
|
+
htmlElement: HTMLElement;
|
|
15
|
+
reactElement: any; //CElement<any, any>;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
type IStore = {
|
|
19
|
-
htmlElement: HTMLElement
|
|
20
|
-
reactElement: CElement<any, any>,
|
|
19
|
+
htmlElement: HTMLElement;
|
|
20
|
+
reactElement: any; //CElement<any, any>,
|
|
21
|
+
domRoot: ReactDom.Root;
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
type ISubject = {
|
|
24
|
-
htmlElement: HTMLElement
|
|
25
|
+
htmlElement: HTMLElement;
|
|
26
|
+
reactElement: any; //CElement<any, any>,
|
|
27
|
+
domRoot: ReactDom.Root;
|
|
25
28
|
};
|
|
26
29
|
|
|
27
|
-
export default <
|
|
28
|
-
ITestShape extends IBaseTest,
|
|
29
|
-
IWhen,
|
|
30
|
-
IGiven
|
|
31
|
-
>(
|
|
30
|
+
export default <ITestShape extends IBaseTest, IWhen, IGiven>(
|
|
32
31
|
testInput: IInput,
|
|
33
|
-
testSpecifications: ITestSpecification<
|
|
34
|
-
|
|
35
|
-
>,
|
|
36
|
-
testImplementations: ITestImplementation<
|
|
37
|
-
ITestShape,
|
|
38
|
-
any
|
|
39
|
-
>,
|
|
40
|
-
|
|
32
|
+
testSpecifications: ITestSpecification<ITestShape>,
|
|
33
|
+
testImplementations: ITestImplementation<ITestShape, any>
|
|
41
34
|
) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return this.done(this);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return Testeranto<
|
|
58
|
-
ITestShape
|
|
59
|
-
>(
|
|
60
|
-
testInput,
|
|
61
|
-
testSpecifications,
|
|
62
|
-
testImplementations,
|
|
63
|
-
{
|
|
64
|
-
beforeAll: async (
|
|
65
|
-
initialProps,
|
|
66
|
-
artificer
|
|
67
|
-
): Promise<ISubject> => {
|
|
68
|
-
console.log("mark5", initialProps);
|
|
69
|
-
return await new Promise((resolve, rej) => {
|
|
70
|
-
const elem = document.getElementById("root");
|
|
71
|
-
if (elem) {
|
|
72
|
-
resolve({ htmlElement: elem });
|
|
73
|
-
}
|
|
35
|
+
class TesterantoComponent extends testInput {
|
|
36
|
+
done: (t: TesterantoComponent) => void;
|
|
37
|
+
constructor(props) {
|
|
38
|
+
super(props);
|
|
39
|
+
this.done = props.done;
|
|
40
|
+
}
|
|
41
|
+
componentDidMount() {
|
|
42
|
+
super.componentDidMount && super.componentDidMount();
|
|
43
|
+
return this.done(this);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
74
46
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
47
|
+
const t = Testeranto<ITestShape>(
|
|
48
|
+
testInput,
|
|
49
|
+
testSpecifications,
|
|
50
|
+
testImplementations,
|
|
51
|
+
{
|
|
52
|
+
beforeAll: async (initialProps, artificer): Promise<ISubject> => {
|
|
53
|
+
console.log("mark5", initialProps);
|
|
54
|
+
return await new Promise((resolve, rej) => {
|
|
55
|
+
const htmlElement = document.getElementById("root");
|
|
56
|
+
if (htmlElement) {
|
|
57
|
+
const domRoot = ReactDom.createRoot(htmlElement);
|
|
58
|
+
// Ignore these type errors
|
|
59
|
+
domRoot.render(
|
|
60
|
+
createElement(
|
|
61
|
+
TesterantoComponent,
|
|
62
|
+
{
|
|
63
|
+
...initialProps,
|
|
64
|
+
done: (reactElement) => {
|
|
65
|
+
resolve({
|
|
93
66
|
htmlElement,
|
|
94
67
|
reactElement,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
68
|
+
domRoot,
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
[]
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
// resolve({ htmlElement });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
// beforeEach: async (
|
|
81
|
+
// s,
|
|
82
|
+
// initializer,
|
|
83
|
+
// testResource,
|
|
84
|
+
// artificer,
|
|
85
|
+
// initialValues
|
|
86
|
+
// ): Promise<IStore> => {
|
|
87
|
+
// return new Promise((resolve, rej) => {
|
|
88
|
+
// console.log("beforeEach" + TesterantoComponent);
|
|
89
|
+
|
|
90
|
+
// // const domRoot = ReactDom.createRoot(htmlElement);
|
|
91
|
+
// // // Ignore these type errors
|
|
92
|
+
// // domRoot.render(
|
|
93
|
+
// // createElement(
|
|
94
|
+
// // TesterantoComponent,
|
|
95
|
+
// // {
|
|
96
|
+
// // ...initializer,
|
|
97
|
+
// // done: (reactElement) => {
|
|
98
|
+
// // resolve({
|
|
99
|
+
// // htmlElement,
|
|
100
|
+
// // reactElement,
|
|
101
|
+
// // domRoot,
|
|
102
|
+
// // });
|
|
103
|
+
// // },
|
|
104
|
+
// // },
|
|
105
|
+
// // []
|
|
106
|
+
// // )
|
|
107
|
+
// // );
|
|
108
|
+
// });
|
|
109
|
+
// },
|
|
110
|
+
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
111
|
+
return whenCB(s);
|
|
112
|
+
},
|
|
113
|
+
butThen: async function (s: IStore, thenCB): Promise<ISelection> {
|
|
114
|
+
return thenCB(s);
|
|
115
|
+
},
|
|
116
|
+
afterEach: async function (store: IStore, ndx, artificer, utils) {
|
|
117
|
+
console.log("afterEach", store);
|
|
118
|
+
utils.writeFileSync("aftereachlog", store.toString());
|
|
119
|
+
|
|
120
|
+
const page = (await utils.browser.pages()).filter((x) => {
|
|
121
|
+
const parsedUrl = new URL(x.url());
|
|
122
|
+
parsedUrl.search = "";
|
|
123
|
+
const strippedUrl = parsedUrl.toString();
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
strippedUrl ===
|
|
127
|
+
"file:///Users/adam/Code/kokomoBay/docs/web/src/ClassicalComponent/react-dom/client.web.test.html"
|
|
128
|
+
);
|
|
129
|
+
// return true;
|
|
130
|
+
})[0];
|
|
131
|
+
|
|
132
|
+
const x = await page.screenshot({
|
|
133
|
+
path: "afterEachLog.jpg",
|
|
134
|
+
});
|
|
135
|
+
console.log("x", x);
|
|
136
|
+
// debugger;
|
|
137
|
+
// const div_root = document.getElementById("root");
|
|
138
|
+
// store.domRoot && store.domRoot.unmount(); //React 18
|
|
139
|
+
// store.remove();
|
|
140
|
+
// store.htmlElement.remove();
|
|
141
|
+
// store.htmlElement = document.createElement("root");
|
|
142
|
+
return store;
|
|
143
|
+
},
|
|
144
|
+
afterAll: async (store: IStore, artificer, utils) => {
|
|
145
|
+
// setTimeout(() => {
|
|
146
|
+
// console.log("This will run after 1 second");
|
|
147
|
+
// }, 1000); // 1000 milliseconds = 1 second
|
|
148
|
+
// store.htmlElement.remove();
|
|
149
|
+
// store.htmlElement = document.createElement("root");
|
|
150
|
+
return store;
|
|
151
|
+
},
|
|
120
152
|
}
|
|
121
|
-
|
|
153
|
+
);
|
|
122
154
|
|
|
155
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
156
|
+
const elem = document.getElementById("root");
|
|
157
|
+
if (elem) {
|
|
158
|
+
return t;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
123
161
|
|
|
162
|
+
return t;
|
|
124
163
|
};
|