testeranto 0.62.0 → 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.
Files changed (151) hide show
  1. package/README.md +42 -21
  2. package/dist/cjs-shim.js +2 -2
  3. package/dist/common/Node.js +7 -24
  4. package/dist/common/NodeWriter.js +7 -9
  5. package/dist/common/Project.js +103 -266
  6. package/dist/common/SubPackages/puppeteer.js +1 -1
  7. package/dist/common/SubPackages/react-dom/component/web.js +1 -1
  8. package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
  9. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  10. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
  11. package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
  12. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -2
  13. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
  14. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  15. package/dist/common/Types.js +2 -32
  16. package/dist/common/Web.js +25 -18
  17. package/dist/common/electron.js +177 -107
  18. package/dist/common/esbuildConfigs/index.js +5 -5
  19. package/dist/common/esbuildConfigs/node.js +17 -15
  20. package/dist/common/esbuildConfigs/report.js +12 -47
  21. package/dist/common/esbuildConfigs/tests.js +0 -1
  22. package/dist/common/esbuildConfigs/web.js +14 -11
  23. package/dist/common/lib/abstractBase.js +13 -6
  24. package/dist/common/lib/basebuilder.js +11 -11
  25. package/dist/common/lib/classBuilder.js +2 -3
  26. package/dist/common/lib/core.js +37 -8
  27. package/dist/common/lib/index.js +10 -8
  28. package/dist/common/lib/types.js +2 -0
  29. package/dist/common/preload.js +15 -25
  30. package/dist/common/puppeteerConfiger.js +24 -0
  31. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  32. package/dist/module/Node.js +7 -24
  33. package/dist/module/NodeWriter.js +7 -9
  34. package/dist/module/Project.js +104 -267
  35. package/dist/module/SubPackages/puppeteer.js +1 -1
  36. package/dist/module/SubPackages/react/jsx/web.js +1 -1
  37. package/dist/module/SubPackages/react-dom/component/node.js +2 -2
  38. package/dist/module/SubPackages/react-dom/component/web.js +1 -1
  39. package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
  40. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  41. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  42. package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
  43. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -2
  44. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
  45. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  46. package/dist/module/Types.js +3 -30
  47. package/dist/module/Web.js +26 -19
  48. package/dist/module/electron.js +179 -109
  49. package/dist/module/esbuildConfigs/index.js +5 -5
  50. package/dist/module/esbuildConfigs/node.js +17 -15
  51. package/dist/module/esbuildConfigs/report.js +11 -48
  52. package/dist/module/esbuildConfigs/tests.js +0 -1
  53. package/dist/module/esbuildConfigs/web.js +14 -11
  54. package/dist/module/lib/abstractBase.js +13 -6
  55. package/dist/module/lib/basebuilder.js +11 -11
  56. package/dist/module/lib/classBuilder.js +2 -3
  57. package/dist/module/lib/core.js +39 -10
  58. package/dist/module/lib/index.js +10 -8
  59. package/dist/module/lib/types.js +1 -0
  60. package/dist/module/preload.js +12 -25
  61. package/dist/module/puppeteerConfiger.js +19 -0
  62. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  63. package/dist/types/Node.d.ts +3 -2
  64. package/dist/types/Project.d.ts +1 -2
  65. package/dist/types/SubPackages/puppeteer.d.ts +3 -3
  66. package/dist/types/SubPackages/react/component/node.d.ts +1 -1
  67. package/dist/types/SubPackages/react/component/web.d.ts +1 -1
  68. package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
  69. package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
  70. package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
  71. package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
  72. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  73. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
  74. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
  75. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
  76. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
  77. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
  78. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
  79. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
  80. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
  81. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
  82. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
  83. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
  84. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
  85. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
  86. package/dist/types/Types.d.ts +19 -100
  87. package/dist/types/Web.d.ts +3 -2
  88. package/dist/types/esbuildConfigs/features.d.ts +1 -1
  89. package/dist/types/esbuildConfigs/index.d.ts +1 -1
  90. package/dist/types/esbuildConfigs/node.d.ts +1 -1
  91. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  92. package/dist/types/esbuildConfigs/tests.d.ts +1 -1
  93. package/dist/types/esbuildConfigs/web.d.ts +1 -1
  94. package/dist/types/lib/abstractBase.d.ts +25 -24
  95. package/dist/types/lib/basebuilder.d.ts +8 -7
  96. package/dist/types/lib/classBuilder.d.ts +3 -2
  97. package/dist/types/lib/core.d.ts +3 -2
  98. package/dist/types/lib/index.d.ts +4 -3
  99. package/dist/types/lib/types.d.ts +70 -0
  100. package/dist/types/puppeteerConfiger.d.ts +4 -0
  101. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  102. package/package.json +4 -3
  103. package/src/Node.ts +24 -54
  104. package/src/NodeWriter.ts +21 -18
  105. package/src/Project.ts +165 -620
  106. package/src/Report.tsx +1 -1
  107. package/src/SubPackages/puppeteer.ts +19 -14
  108. package/src/SubPackages/react/component/node.ts +20 -32
  109. package/src/SubPackages/react/component/web.ts +20 -30
  110. package/src/SubPackages/react/jsx/index.ts +13 -24
  111. package/src/SubPackages/react/jsx/web.ts +10 -8
  112. package/src/SubPackages/react-dom/component/node.ts +17 -23
  113. package/src/SubPackages/react-dom/component/web.ts +30 -50
  114. package/src/SubPackages/react-dom/jsx/web.ts +41 -48
  115. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
  116. package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
  117. package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
  118. package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
  119. package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
  120. package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
  121. package/src/SubPackages/react-test-renderer/jsx/index.ts +16 -21
  122. package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
  123. package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
  124. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
  125. package/src/Types.ts +73 -307
  126. package/src/Web.ts +54 -53
  127. package/src/cjs-shim.js +2 -2
  128. package/src/electron.ts +258 -191
  129. package/src/esbuildConfigs/features.ts +3 -4
  130. package/src/esbuildConfigs/index.ts +8 -8
  131. package/src/esbuildConfigs/node.ts +21 -20
  132. package/src/esbuildConfigs/report.ts +15 -51
  133. package/src/esbuildConfigs/tests.ts +3 -9
  134. package/src/esbuildConfigs/web.ts +18 -18
  135. package/src/lib/abstractBase.ts +78 -125
  136. package/src/lib/basebuilder.ts +109 -134
  137. package/src/lib/classBuilder.ts +26 -45
  138. package/src/lib/core.ts +101 -69
  139. package/src/lib/index.ts +53 -52
  140. package/src/lib/types.ts +206 -0
  141. package/src/preload.ts +12 -28
  142. package/src/puppeteerConfiger.ts +26 -0
  143. package/src/web.html.ts +1 -1
  144. package/dist/common/lib/browser.js +0 -26
  145. package/dist/common/nodeWriterElectron.js +0 -55
  146. package/dist/module/lib/browser.js +0 -22
  147. package/dist/module/nodeWriterElectron.js +0 -52
  148. package/dist/types/lib/browser.d.ts +0 -6
  149. package/dist/types/nodeWriterElectron.d.ts +0 -2
  150. package/src/lib/browser.ts +0 -34
  151. package/src/nodeWriterElectron.ts +0 -71
package/src/Report.tsx CHANGED
@@ -10,8 +10,8 @@ import { Sigma, RandomizeNodePositions, RelativeSize } from 'react-sigma';
10
10
 
11
11
  import 'bootstrap/dist/css/bootstrap.min.css';
12
12
 
13
- import type { ITestTypes } from "./Types";
14
13
  import { TesterantoFeatures } from "./Features.js";
14
+ import { ITestTypes } from "./lib/types.js";
15
15
 
16
16
  type IGraphData = {
17
17
  nodes: { id: string, label: string }[],
@@ -2,22 +2,27 @@ import React from "react";
2
2
 
3
3
  import Testeranto from "../Node.js";
4
4
 
5
- import { IBaseTest, IPartialInterface, ITestImplementation, ITestSpecification } from "../Types";
5
+ import {
6
+ IBaseTest,
7
+ IPartialNodeInterface,
8
+ ITestImplementation,
9
+ ITestSpecification,
10
+ } from "../Types";
6
11
 
7
12
  type IInput = string;
8
13
  type ISelection = any;
9
- type IStore = any
10
- type ISubject = any
14
+ type IStore = any;
15
+ type ISubject = any;
11
16
 
12
- export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec, object>
17
+ export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec>;
13
18
 
14
19
  export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
15
20
 
16
21
  export default <ITestShape extends IBaseTest>(
17
22
  testInput: IInput,
18
23
  testSpecifications: ISpec<ITestShape>,
19
- testImplementations: ITestImplementation<ITestShape, object>,
20
- testInterface?: IPartialInterface<ITestShape>
24
+ testImplementations: ITestImplementation<ITestShape>,
25
+ testInterface?: IPartialNodeInterface<ITestShape>
21
26
  ) => {
22
27
  return Testeranto<ITestShape>(
23
28
  testInput,
@@ -25,22 +30,22 @@ export default <ITestShape extends IBaseTest>(
25
30
  testImplementations,
26
31
  {
27
32
  beforeAll(x) {
28
- process.parentPort.postMessage(`/dist/web/src/ClassicalComponent/test.html`)
33
+ process.parentPort.postMessage(
34
+ `/docs/web/src/ClassicalComponent/test.html`
35
+ );
29
36
 
30
37
  return x;
31
38
  },
32
- beforeEach: async (
33
- ): Promise<IStore> => {
39
+ beforeEach: async (): Promise<IStore> => {
34
40
  return new Promise((resolve, rej) => {
35
- resolve(React.createElement(testInput, {
36
- }, []));
41
+ resolve(React.createElement(testInput, {}, []));
37
42
  });
38
43
  },
39
44
  andWhen: function (s: IStore, whenCB): Promise<ISelection> {
40
45
  return whenCB()(s);
41
46
  },
42
47
 
43
- ...testInterface
44
- },
45
- )
48
+ ...testInterface,
49
+ }
50
+ );
46
51
  };
@@ -2,54 +2,42 @@ import React from "react";
2
2
 
3
3
  import Testeranto from "../../../Node.js";
4
4
 
5
- import { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
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 extends IBaseTest,
14
- IState
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 default <
26
- ITestShape extends IBaseTest,
27
- IState
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 { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
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 extends IBaseTest,
14
- IState
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 default <
26
- ITestShape extends IBaseTest,
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, ITestImplementation, ITestSpecification
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 extends IBaseTest
17
- > = ITestImplementation<
18
- ITestShape, object
19
- >
17
+ export type ITestImpl<ITestShape extends IBaseTest> =
18
+ ITestImplementation<ITestShape>;
20
19
 
21
- export type ITestSpec<
22
- ITestShape extends IBaseTest
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
+ };
@@ -1,28 +1,30 @@
1
- import { IBaseTest, IPartialInterface } from "../../../Types";
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: IPartialInterface<ITestShape>
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 { renderToStaticMarkup, renderToStaticNodeStream } from "react-dom/server";
3
- import Stream from 'stream'
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 { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
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
- ITestShape, object
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,39 +5,29 @@ 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
21
  };
22
22
 
23
23
  type ISubject = {
24
- htmlElement: HTMLElement
24
+ htmlElement: HTMLElement;
25
25
  };
26
26
 
27
- export default <
28
- ITestShape extends IBaseTest,
29
- IWhen,
30
- IGiven
31
- >(
27
+ export default <ITestShape extends IBaseTest, IWhen, IGiven>(
32
28
  testInput: IInput,
33
- testSpecifications: ITestSpecification<
34
- ITestShape
35
- >,
36
- testImplementations: ITestImplementation<
37
- ITestShape,
38
- any
39
- >,
40
-
29
+ testSpecifications: ITestSpecification<ITestShape>,
30
+ testImplementations: ITestImplementation<ITestShape, any>
41
31
  ) => {
42
32
  document.addEventListener("DOMContentLoaded", function () {
43
33
  const elem = document.getElementById("root");
@@ -54,25 +44,19 @@ export default <
54
44
  }
55
45
  }
56
46
 
57
- return Testeranto<
58
- ITestShape
59
- >(
47
+ return Testeranto<ITestShape>(
60
48
  testInput,
61
49
  testSpecifications,
62
50
  testImplementations,
63
51
  {
64
- beforeAll: async (
65
- initialProps,
66
- artificer
67
- ): Promise<ISubject> => {
52
+ beforeAll: async (initialProps, artificer): Promise<ISubject> => {
68
53
  console.log("mark5", initialProps);
69
54
  return await new Promise((resolve, rej) => {
70
55
  const elem = document.getElementById("root");
71
56
  if (elem) {
72
57
  resolve({ htmlElement: elem });
73
58
  }
74
-
75
- })
59
+ });
76
60
  },
77
61
  beforeEach: async (
78
62
  { htmlElement },
@@ -84,19 +68,21 @@ export default <
84
68
  return new Promise((resolve, rej) => {
85
69
  // console.log("beforeEach" + JSON.stringify(initializer) + JSON.stringify(initialValues));
86
70
  // Ignore these type errors
87
- ReactDom.createRoot(htmlElement).render(createElement(
88
- TesterantoComponent, {
89
- ...initializer.props,
90
- done: (reactElement) => {
91
- resolve(
92
- {
93
- htmlElement,
94
- reactElement,
95
- }
96
- );
97
- }
98
- }, []
99
- ));
71
+ ReactDom.createRoot(htmlElement).render(
72
+ createElement(
73
+ TesterantoComponent,
74
+ {
75
+ ...initializer,
76
+ done: (reactElement) => {
77
+ resolve({
78
+ htmlElement,
79
+ reactElement,
80
+ });
81
+ },
82
+ },
83
+ []
84
+ )
85
+ );
100
86
  });
101
87
  },
102
88
  andWhen: function (s: IStore, whenCB): Promise<ISelection> {
@@ -105,20 +91,14 @@ export default <
105
91
  butThen: async function (s: IStore): Promise<ISelection> {
106
92
  return s;
107
93
  },
108
- afterEach: async function (
109
- store: IStore,
110
- ndx,
111
- artificer
112
- ) {
94
+ afterEach: async function (store: IStore, ndx, artificer) {
113
95
  return {};
114
96
  },
115
97
  afterAll: (store: IStore, artificer) => {
116
98
  return;
117
99
  },
118
- },
119
- )
100
+ }
101
+ );
120
102
  }
121
103
  });
122
-
123
-
124
104
  };
@@ -1,60 +1,50 @@
1
- import React, { useEffect, useRef, } from "react";
2
- import { createPortal } from 'react-dom';
1
+ import React, { useEffect, useRef } from "react";
2
+ import { createPortal } from "react-dom";
3
3
 
4
4
  import Testeranto from "../../../Web.js";
5
- import { IBaseTest, ITestImplementation, ITestSpecification } from "../../../Types";
5
+ import {
6
+ IBaseTest,
7
+ ITestImplementation,
8
+ ITestSpecification,
9
+ } from "../../../Types";
6
10
 
7
- import type {
8
- IInput,
9
- ISelection,
10
- IStore,
11
- } from "./index";
11
+ import type { IInput, ISelection, IStore } from "./index";
12
12
 
13
13
  export type ISubject = HTMLElement;
14
14
 
15
15
  export default <ITestShape extends IBaseTest>(
16
- testImplementations: ITestImplementation<
17
- ITestShape,
18
- object
19
- >,
20
- testSpecifications: ITestSpecification<
21
- ITestShape
22
- >,
16
+ testImplementations: ITestImplementation<ITestShape>,
17
+ testSpecifications: ITestSpecification<ITestShape>,
23
18
  testInput: IInput
24
19
  ) => {
25
20
  document.addEventListener("DOMContentLoaded", function () {
26
21
  const rootElement = document.getElementById("root");
27
22
  if (rootElement) {
28
- const TesterantoComponent = function ({ done, innerComp }: { done: (ref: React.MutableRefObject<any>) => any, innerComp: IInput }) {
23
+ const TesterantoComponent = function ({
24
+ done,
25
+ innerComp,
26
+ }: {
27
+ done: (ref: React.MutableRefObject<any>) => any;
28
+ innerComp: IInput;
29
+ }) {
29
30
  const myContainer = useRef<any>(null);
30
31
  useEffect(() => {
31
- console.log(
32
- "useEffect called", myContainer.current
33
- );
32
+ console.log("useEffect called", myContainer.current);
34
33
  done(myContainer.current);
35
34
  }, []);
36
35
 
37
- return React.createElement(
38
- 'div',
39
- { ref: myContainer },
40
- innerComp()
41
- );
36
+ return React.createElement("div", { ref: myContainer }, innerComp());
42
37
  };
43
38
 
44
- Testeranto<
45
- ITestShape
46
- >(
39
+ Testeranto<ITestShape>(
47
40
  testInput,
48
41
  testSpecifications,
49
42
  testImplementations,
50
43
  {
51
- beforeAll: async (
52
- input,
53
- artificer
54
- ): Promise<HTMLElement> => {
44
+ beforeAll: async (input, artificer): Promise<HTMLElement> => {
55
45
  return await new Promise((resolve, rej) => {
56
46
  resolve(rootElement);
57
- })
47
+ });
58
48
  },
59
49
 
60
50
  beforeEach: async (
@@ -69,41 +59,44 @@ export default <ITestShape extends IBaseTest>(
69
59
  innerComp: testInput,
70
60
  done: (reactElement: any) => {
71
61
  process.nextTick(() => {
72
- resolve(reactElement)
73
- })
74
- }
75
- },
76
- ),
62
+ resolve(reactElement);
63
+ });
64
+ },
65
+ }),
77
66
  rootElement
78
67
  );
79
68
  });
80
69
  },
81
70
  andWhen: function (s: IStore, whenCB): Promise<ISelection> {
82
71
  return new Promise((resolve, rej) => {
83
- process.nextTick(() => { resolve(whenCB()(s)) })
72
+ process.nextTick(() => {
73
+ resolve(whenCB()(s));
74
+ });
84
75
  });
85
76
  },
86
77
  butThen: async function (s: IStore): Promise<ISelection> {
87
78
  return new Promise((resolve, rej) => {
88
- process.nextTick(() => { resolve(s) })
79
+ process.nextTick(() => {
80
+ resolve(s);
81
+ });
89
82
  });
90
83
  },
91
- afterEach: async function (
92
- store: IStore,
93
- ndx,
94
- artificer
95
- ) {
84
+ afterEach: async function (store: IStore, ndx, artificer) {
96
85
  return new Promise((resolve, rej) => {
97
- process.nextTick(() => { resolve({}) })
86
+ process.nextTick(() => {
87
+ resolve({});
88
+ });
98
89
  });
99
90
  },
100
91
  afterAll: (store: IStore, artificer) => {
101
92
  return new Promise((resolve, rej) => {
102
- process.nextTick(() => { resolve({}) })
93
+ process.nextTick(() => {
94
+ resolve({});
95
+ });
103
96
  });
104
97
  },
105
- },
106
- )
98
+ }
99
+ );
107
100
  }
108
101
  });
109
102
  };