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.
Files changed (186) hide show
  1. package/README.md +38 -26
  2. package/dist/cjs-shim.js +2 -2
  3. package/dist/common/Node.js +14 -51
  4. package/dist/common/PM/index.js +71 -0
  5. package/dist/common/PM/main.js +361 -0
  6. package/dist/common/PM/node.js +176 -0
  7. package/dist/common/PM/web.js +174 -0
  8. package/dist/common/Project.js +121 -266
  9. package/dist/common/Puppeteer.js +109 -0
  10. package/dist/common/Reporter.js +119 -0
  11. package/dist/common/Scheduler.js +1 -0
  12. package/dist/common/SubPackages/puppeteer.js +3 -1
  13. package/dist/common/SubPackages/react-dom/component/web.js +98 -45
  14. package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
  15. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  16. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
  17. package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
  18. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
  19. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
  20. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  21. package/dist/common/Types.js +2 -32
  22. package/dist/common/Web.js +25 -37
  23. package/dist/common/esbuildConfigs/index.js +5 -5
  24. package/dist/common/esbuildConfigs/node.js +17 -15
  25. package/dist/common/esbuildConfigs/report.js +12 -47
  26. package/dist/common/esbuildConfigs/tests.js +0 -1
  27. package/dist/common/esbuildConfigs/web.js +17 -12
  28. package/dist/common/lib/abstractBase.js +190 -35
  29. package/dist/common/lib/basebuilder.js +56 -29
  30. package/dist/common/lib/classBuilder.js +8 -5
  31. package/dist/common/lib/core.js +42 -17
  32. package/dist/common/lib/index.js +11 -8
  33. package/dist/common/lib/types.js +2 -0
  34. package/dist/common/preload.js +14 -28
  35. package/dist/common/puppeteerConfiger.js +24 -0
  36. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  37. package/dist/module/Node.js +14 -51
  38. package/dist/module/PM/index.js +67 -0
  39. package/dist/module/PM/main.js +331 -0
  40. package/dist/module/PM/node.js +168 -0
  41. package/dist/module/PM/web.js +167 -0
  42. package/dist/module/Project.js +122 -267
  43. package/dist/module/Puppeteer.js +104 -0
  44. package/dist/module/Reporter.js +114 -0
  45. package/dist/module/Scheduler.js +1 -0
  46. package/dist/module/SubPackages/puppeteer.js +3 -1
  47. package/dist/module/SubPackages/react/jsx/node.js +1 -1
  48. package/dist/module/SubPackages/react/jsx/web.js +1 -1
  49. package/dist/module/SubPackages/react-dom/component/node.js +2 -2
  50. package/dist/module/SubPackages/react-dom/component/web.js +98 -45
  51. package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
  52. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  53. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  54. package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
  55. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
  56. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
  57. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  58. package/dist/module/Types.js +3 -30
  59. package/dist/module/Web.js +26 -38
  60. package/dist/module/esbuildConfigs/index.js +5 -5
  61. package/dist/module/esbuildConfigs/node.js +17 -15
  62. package/dist/module/esbuildConfigs/report.js +11 -48
  63. package/dist/module/esbuildConfigs/tests.js +0 -1
  64. package/dist/module/esbuildConfigs/web.js +17 -12
  65. package/dist/module/lib/abstractBase.js +190 -35
  66. package/dist/module/lib/basebuilder.js +56 -29
  67. package/dist/module/lib/classBuilder.js +8 -5
  68. package/dist/module/lib/core.js +44 -19
  69. package/dist/module/lib/index.js +11 -8
  70. package/dist/module/preload.js +15 -27
  71. package/dist/module/puppeteerConfiger.js +19 -0
  72. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  73. package/dist/prebuild/Report.css +1616 -584
  74. package/dist/prebuild/Report.js +2635 -2506
  75. package/dist/types/Node.d.ts +3 -2
  76. package/dist/types/PM/index.d.ts +19 -0
  77. package/dist/types/PM/main.d.ts +28 -0
  78. package/dist/types/PM/node.d.ts +26 -0
  79. package/dist/types/PM/web.d.ts +24 -0
  80. package/dist/types/Project.d.ts +1 -2
  81. package/dist/types/Puppeteer.d.ts +1 -0
  82. package/dist/types/Reporter.d.ts +1 -0
  83. package/dist/types/Scheduler.d.ts +0 -0
  84. package/dist/types/SubPackages/puppeteer.d.ts +3 -3
  85. package/dist/types/SubPackages/react/component/node.d.ts +1 -1
  86. package/dist/types/SubPackages/react/component/web.d.ts +1 -1
  87. package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
  88. package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
  89. package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
  90. package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
  91. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  92. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
  93. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
  94. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
  95. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
  96. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
  97. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
  98. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
  99. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
  100. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
  101. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
  102. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
  103. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
  104. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
  105. package/dist/types/Types.d.ts +19 -100
  106. package/dist/types/Web.d.ts +3 -2
  107. package/dist/types/esbuildConfigs/features.d.ts +1 -1
  108. package/dist/types/esbuildConfigs/index.d.ts +1 -1
  109. package/dist/types/esbuildConfigs/node.d.ts +1 -1
  110. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  111. package/dist/types/esbuildConfigs/tests.d.ts +1 -1
  112. package/dist/types/esbuildConfigs/web.d.ts +1 -1
  113. package/dist/types/lib/abstractBase.d.ts +26 -24
  114. package/dist/types/lib/basebuilder.d.ts +10 -7
  115. package/dist/types/lib/classBuilder.d.ts +4 -3
  116. package/dist/types/lib/core.d.ts +5 -4
  117. package/dist/types/lib/index.d.ts +7 -5
  118. package/dist/types/lib/types.d.ts +62 -0
  119. package/dist/types/preload.d.ts +0 -1
  120. package/dist/types/puppeteerConfiger.d.ts +4 -0
  121. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  122. package/package.json +6 -7
  123. package/src/Node.ts +30 -85
  124. package/src/PM/index.ts +102 -0
  125. package/src/PM/main.ts +420 -0
  126. package/src/PM/node.ts +515 -0
  127. package/src/PM/web.ts +497 -0
  128. package/src/Project.ts +183 -619
  129. package/src/Puppeteer.ts +131 -0
  130. package/src/Report.tsx +158 -44
  131. package/src/Reporter.ts +134 -0
  132. package/src/Scheduler.ts +0 -0
  133. package/src/SubPackages/puppeteer.ts +19 -14
  134. package/src/SubPackages/react/component/node.ts +20 -32
  135. package/src/SubPackages/react/component/web.ts +20 -30
  136. package/src/SubPackages/react/jsx/index.ts +13 -24
  137. package/src/SubPackages/react/jsx/node.ts +5 -8
  138. package/src/SubPackages/react/jsx/web.ts +10 -8
  139. package/src/SubPackages/react-dom/component/node.ts +17 -23
  140. package/src/SubPackages/react-dom/component/web.ts +134 -95
  141. package/src/SubPackages/react-dom/jsx/web.ts +41 -48
  142. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
  143. package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
  144. package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
  145. package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
  146. package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
  147. package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
  148. package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
  149. package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
  150. package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
  151. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
  152. package/src/Types.ts +73 -307
  153. package/src/Web.ts +40 -81
  154. package/src/cjs-shim.js +2 -2
  155. package/src/esbuildConfigs/features.ts +3 -4
  156. package/src/esbuildConfigs/index.ts +8 -8
  157. package/src/esbuildConfigs/node.ts +21 -20
  158. package/src/esbuildConfigs/report.ts +15 -51
  159. package/src/esbuildConfigs/tests.ts +3 -9
  160. package/src/esbuildConfigs/web.ts +22 -20
  161. package/src/lib/abstractBase.ts +312 -164
  162. package/src/lib/basebuilder.ts +123 -127
  163. package/src/lib/classBuilder.ts +30 -48
  164. package/src/lib/core.ts +115 -84
  165. package/src/lib/index.ts +58 -56
  166. package/src/lib/types.ts +197 -0
  167. package/src/preload.ts +14 -30
  168. package/src/puppeteerConfiger.ts +26 -0
  169. package/src/web.html.ts +1 -1
  170. package/dist/common/NodeWriter.js +0 -56
  171. package/dist/common/electron.js +0 -196
  172. package/dist/common/lib/browser.js +0 -26
  173. package/dist/common/nodeWriterElectron.js +0 -55
  174. package/dist/module/NodeWriter.js +0 -50
  175. package/dist/module/electron.js +0 -191
  176. package/dist/module/lib/browser.js +0 -22
  177. package/dist/module/nodeWriterElectron.js +0 -52
  178. package/dist/types/NodeWriter.d.ts +0 -2
  179. package/dist/types/lib/browser.d.ts +0 -6
  180. package/dist/types/nodeWriterElectron.d.ts +0 -2
  181. package/src/NodeWriter.ts +0 -69
  182. package/src/electron.ts +0 -250
  183. package/src/lib/browser.ts +0 -34
  184. package/src/nodeWriterElectron.ts +0 -71
  185. package/yarn-error.log +0 -3144
  186. /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
@@ -1,16 +1,17 @@
1
1
  import { BaseBuilder } from "./basebuilder.js";
2
2
  export class ClassBuilder extends BaseBuilder {
3
- constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement, logWriter) {
3
+ constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement
4
+ // puppetMaster: PM
5
+ ) {
4
6
  const classySuites = Object.entries(testImplementation.suites).reduce((a, [key], index) => {
5
7
  a[key] = (somestring, givens, checks) => {
6
8
  return new suiteKlasser.prototype.constructor(somestring, index, givens, checks);
7
9
  };
8
10
  return a;
9
11
  }, {});
10
- const classyGivens = Object.entries(testImplementation.givens)
11
- .reduce((a, [key, givEn]) => {
12
+ const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, givEn]) => {
12
13
  a[key] = (features, whens, thens, givEn) => {
13
- return new (givenKlasser.prototype).constructor(key, features, whens, thens, testImplementation.givens[key], givEn);
14
+ return new givenKlasser.prototype.constructor(key, features, whens, thens, testImplementation.givens[key], givEn);
14
15
  };
15
16
  return a;
16
17
  }, {});
@@ -32,6 +33,8 @@ export class ClassBuilder extends BaseBuilder {
32
33
  };
33
34
  return a;
34
35
  }, {});
35
- super(input, classySuites, classyGivens, classyWhens, classyThens, classyChecks, logWriter, testResourceRequirement, testSpecification);
36
+ super(input, classySuites, classyGivens, classyWhens, classyThens, classyChecks, testResourceRequirement, testSpecification
37
+ // puppetMaster
38
+ );
36
39
  }
37
40
  }
@@ -1,31 +1,54 @@
1
- import { DefaultTestInterface, defaultTestResourceRequirement } from "./index.js";
2
- import { BaseSuite, BaseGiven, BaseWhen, BaseThen, BaseCheck } from "./abstractBase.js";
1
+ import { DefaultTestInterface, defaultTestResourceRequirement, } from "./index.js";
2
+ import { BaseSuite, BaseGiven, BaseWhen, BaseThen, BaseCheck, } from "./abstractBase.js";
3
3
  import { ClassBuilder } from "./classBuilder.js";
4
4
  export default class Testeranto extends ClassBuilder {
5
- constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, logWriter, testInterface) {
5
+ constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testInterface
6
+ // puppetMaster: PM
7
+ ) {
6
8
  const fullTestInterface = DefaultTestInterface(testInterface);
7
9
  super(testImplementation, testSpecification, input, class extends BaseSuite {
10
+ afterAll(store, artifactory, pm) {
11
+ // const pagesHandler = {
12
+ // get(target, prop) {
13
+ // console.log(`Getting pages property ${prop}`);
14
+ // return target[prop];
15
+ // },
16
+ // };
17
+ // const browserHandler = {
18
+ // get(target, prop) {
19
+ // console.log(`Getting browser property ${prop}`);
20
+ // if (prop === "pages") {
21
+ // // return target[prop];
22
+ // return new Proxy(target[prop], pagesHandler);
23
+ // } else {
24
+ // return target[prop];
25
+ // }
26
+ // },
27
+ // };
28
+ // const proxy = new Proxy(utils.browser, browserHandler);
29
+ return fullTestInterface.afterAll(store, (fPath, value) => {
30
+ artifactory(`afterAll4-${this.name}/${fPath}`, value);
31
+ }, pm);
32
+ }
8
33
  assertThat(t) {
9
34
  fullTestInterface.assertThis(t);
10
35
  }
11
- async setup(s, artifactory, tr) {
12
- return (fullTestInterface.beforeAll || (async (input, artifactory, tr) => input))(s, this.testResourceConfiguration, artifactory);
36
+ async setup(s, artifactory, tr, pm) {
37
+ return (fullTestInterface.beforeAll ||
38
+ (async (input, artifactory, tr, pm) => input))(s, this.testResourceConfiguration, artifactory, pm);
13
39
  }
14
40
  }, class Given extends BaseGiven {
15
- async givenThat(subject, testResource, artifactory, initializer) {
41
+ async givenThat(subject, testResource, artifactory, initializer, pm) {
16
42
  return fullTestInterface.beforeEach(subject, initializer, (fPath, value) =>
17
43
  // TODO does not work?
18
- artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues);
19
- }
20
- afterEach(store, key, artifactory) {
21
- return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value))));
44
+ artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues, pm);
22
45
  }
23
- afterAll(store, artifactory, utils) {
24
- return fullTestInterface.afterAll(store, (fPath, value) => { artifactory(`afterAll4-${this.name}/${fPath}`, value); }, utils);
46
+ afterEach(store, key, artifactory, pm) {
47
+ return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value), pm)));
25
48
  }
26
49
  }, class When extends BaseWhen {
27
- async andWhen(store, whenCB, testResource) {
28
- return await fullTestInterface.andWhen(store, whenCB, testResource);
50
+ async andWhen(store, whenCB, testResource, pm) {
51
+ return await fullTestInterface.andWhen(store, whenCB, testResource, pm);
29
52
  }
30
53
  }, class Then extends BaseThen {
31
54
  async butThen(store, thenCB, testResourceConfiguration) {
@@ -36,14 +59,16 @@ export default class Testeranto extends ClassBuilder {
36
59
  super(name, features, checkCallback, whens, thens);
37
60
  this.initialValues = initialValues;
38
61
  }
39
- async checkThat(subject, testResourceConfiguration, artifactory) {
40
- return fullTestInterface.beforeEach(subject, this.initialValues, (fPath, value) => artifactory(`before/${fPath}`, value), testResourceConfiguration, this.initialValues);
62
+ async checkThat(subject, testResourceConfiguration, artifactory, pm) {
63
+ return fullTestInterface.beforeEach(subject, this.initialValues, (fPath, value) => artifactory(`before/${fPath}`, value), testResourceConfiguration, this.initialValues, pm);
41
64
  }
42
- afterEach(store, key, artifactory) {
65
+ afterEach(store, key, artifactory, pm) {
43
66
  return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) =>
44
67
  // TODO does not work?
45
- artifactory(`afterEach2-${this.name}/${fPath}`, value))));
68
+ artifactory(`afterEach2-${this.name}/${fPath}`, value), pm)));
46
69
  }
47
- }, testResourceRequirement, logWriter);
70
+ }, testResourceRequirement
71
+ // puppetMaster
72
+ );
48
73
  }
49
74
  }
@@ -1,15 +1,18 @@
1
+ // import { INodeUtils, ITestInterface, IUtils, IWebUtils } from "./types.js";
1
2
  export const BaseTestInterface = {
2
- beforeAll: (async (s) => s),
3
- beforeEach: async function (subject, initialValues, testResource) { return subject; },
4
- afterEach: (async (s) => s),
5
- afterAll: ((store) => undefined),
6
- butThen: (async (store, thenCb) => thenCb(store)),
7
- andWhen: ((a) => a),
8
- assertThis: (() => null),
3
+ beforeAll: async (s) => s,
4
+ beforeEach: async function (subject, initialValues, x, testResource, pm) {
5
+ return subject;
6
+ },
7
+ afterEach: async (s) => s,
8
+ afterAll: (store) => undefined,
9
+ butThen: async (store, thenCb) => thenCb(store),
10
+ andWhen: (a) => a,
11
+ assertThis: () => null,
9
12
  };
10
13
  export const DefaultTestInterface = (p) => {
11
14
  return Object.assign(Object.assign({}, BaseTestInterface), p);
12
15
  };
13
16
  export const defaultTestResourceRequirement = {
14
- ports: 0
17
+ ports: 0,
15
18
  };
@@ -1,27 +1,15 @@
1
- import { ipcRenderer } from "electron";
2
- console.log("hello preloader");
3
- import { NodeWriter } from "./NodeWriter";
4
- window.NodeWriter = NodeWriter;
5
- window.exit = (x) => {
6
- ipcRenderer.invoke('quit-app', x);
7
- };
8
- // var oldLog = console.log;
9
- // console.log = function (message) {
10
- // ipcRenderer.invoke('web-log', message.toString());
11
- // oldLog.apply(console, arguments);
12
- // };
13
- // var oldLog = console.error;
14
- // console.error = function (message) {
15
- // ipcRenderer.invoke('web-error', message.toString());
16
- // oldLog.apply(console, arguments);
17
- // };
18
- // var oldLog = console.warn;
19
- // console.warn = function (message) {
20
- // ipcRenderer.invoke('web-warn', message.toString());
21
- // oldLog.apply(console, arguments);
22
- // };
23
- // var oldLog = console.info;
24
- // console.info = function (message) {
25
- // ipcRenderer.invoke('web-info', message.toString());
26
- // oldLog.apply(console, arguments);
27
- // };
1
+ "use strict";
2
+ // import puppeteer from "puppeteer-core";
3
+ // import { NodeWriter } from "./NodeWriter";
4
+ // import puppeteerConfiger from "./puppeteerConfiger";
5
+ // (window as any).NodeWriter = NodeWriter;
6
+ // (window as any).browser = new Promise(async (res, rej) => {
7
+ // const browser = await puppeteerConfiger("2999").then(async (json) => {
8
+ // const b = await puppeteer.connect({
9
+ // browserWSEndpoint: json.webSocketDebuggerUrl,
10
+ // defaultViewport: null,
11
+ // });
12
+ // console.log("connected!", b.isConnected());
13
+ // return res(b);
14
+ // });
15
+ // });
@@ -0,0 +1,19 @@
1
+ import http from "http";
2
+ export default async (port) => new Promise((resolve, reject) => {
3
+ let json = "";
4
+ const request = http.request({
5
+ host: "127.0.0.1",
6
+ path: "/json/version",
7
+ port,
8
+ }, (response) => {
9
+ response.on("error", reject);
10
+ response.on("data", (chunk) => {
11
+ json += chunk.toString();
12
+ });
13
+ response.on("end", () => {
14
+ resolve(JSON.parse(json));
15
+ });
16
+ });
17
+ request.on("error", reject);
18
+ request.end();
19
+ });