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
@@ -4,32 +4,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const index_js_1 = __importDefault(require("./index.js"));
7
- // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
8
7
  exports.default = (config, entryPoints) => {
9
- return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], supported: {
10
- "dynamic-import": true
8
+ return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { splitting: true, outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], supported: {
9
+ "dynamic-import": true,
11
10
  }, define: {
12
- "process.env.FLUENTFFMPEG_COV": "0"
11
+ "process.env.FLUENTFFMPEG_COV": "0",
13
12
  }, absWorkingDir: process.cwd(), banner: {
14
- js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
13
+ js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
15
14
  }, platform: "node", external: [
16
- "testeranto.json",
17
- "features.test.js",
18
- "react",
19
- "events",
15
+ // "testeranto.json",
16
+ // "features.test.js",
17
+ // "react",
18
+ // "events",
20
19
  // "ganache"
21
- ...config.externals
20
+ ...config.externals,
22
21
  ], entryPoints: [...entryPoints], plugins: [
23
22
  ...(config.nodePlugins || []),
24
23
  {
25
- name: 'rebuild-notify',
24
+ name: "rebuild-notify",
26
25
  setup(build) {
27
- build.onEnd(result => {
26
+ build.onEnd((result) => {
28
27
  console.log(`node build ended with ${result.errors.length} errors`);
29
- console.log(result);
30
- result.errors.length !== 0 && process.exit(-1);
28
+ if (result.errors.length > 0) {
29
+ console.log(result);
30
+ }
31
+ // console.log(result);
32
+ // result.errors.length !== 0 && process.exit(-1);
31
33
  });
32
- }
34
+ },
33
35
  },
34
36
  ] });
35
37
  };
@@ -1,48 +1,13 @@
1
1
  "use strict";
2
- // import { jsonc } from "jsonc";
3
- // import { IBaseConfig, IJsonConfig } from "../Types";
4
- // import baseEsBuildConfig from "./index.js";
5
- // import fs from "fs"
6
- // import { BuildOptions } from "esbuild";
7
- // // import { CssModulesPlugin } from 'esbuild-css-modules-plugin';
8
- // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
9
- // export default (config: IBaseConfig): BuildOptions => {
10
- // return {
11
- // bundle: true,
12
- // entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
13
- // minify: config.minify === true,
14
- // outbase: config.outbase,
15
- // write: true,
16
- // outfile: `${jsonConfig.outdir}/report.js`,
17
- // external: [
18
- // "tests.json",
19
- // "features.test.js"
20
- // ],
21
- // // plugins: [
22
- // // CssModulesPlugin({
23
- // // // @see https://github.com/indooorsman/esbuild-css-modules-plugin/blob/main/index.d.ts for more details
24
- // // force: true,
25
- // // emitDeclarationFile: true,
26
- // // localsConvention: 'camelCaseOnly',
27
- // // namedExports: true,
28
- // // inject: false
29
- // // })
30
- // // ]
31
- // }
32
- // // return {
33
- // // bundle: true,
34
- // // entryPoints: [
35
- // // "./node_modules/testeranto/dist/module/Report.js",
36
- // // jsonConfig.features
37
- // // ],
38
- // // minify: config.minify === true,
39
- // // outbase: ".",
40
- // // outdir: 'docs',
41
- // // write: true,
42
- // // // outfile: `${jsonConfig.outdir}/Report.js`,
43
- // // external: [
44
- // // "features.test.js",
45
- // // "testeranto.json"
46
- // // ]
47
- // // }
48
- // }
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (config) => {
4
+ return {
5
+ bundle: true,
6
+ entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
7
+ minify: config.minify === true,
8
+ outbase: config.outbase,
9
+ write: true,
10
+ outfile: `${config.outdir}/report.js`,
11
+ external: ["tests.json", "features.test.js"],
12
+ };
13
+ };
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
4
3
  exports.default = (config) => {
5
4
  return {
6
5
  bundle: true,
@@ -5,19 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const index_js_1 = __importDefault(require("./index.js"));
8
- // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
9
8
  exports.default = (config, entryPoints) => {
10
9
  return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), {
11
- // inject: ['./node_modules/testeranto/dist/cjs-shim.js'],
10
+ // inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
12
11
  // banner: {
13
- // js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
12
+ // js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
14
13
  // },
14
+ // splitting: true,
15
15
  outdir: config.outdir + "/web", alias: {
16
- react: path_1.default.resolve("./node_modules/react")
16
+ react: path_1.default.resolve("./node_modules/react"),
17
17
  }, external: [
18
18
  "testeranto.json",
19
19
  "features.test.ts",
20
- // "url",
20
+ // "url",
21
21
  "react",
22
22
  "electron",
23
23
  "path",
@@ -33,18 +33,21 @@ exports.default = (config, entryPoints) => {
33
33
  "readline",
34
34
  "zlib",
35
35
  "crypto",
36
- "https"
36
+ "https",
37
37
  ], platform: "browser", entryPoints: [...entryPoints], plugins: [
38
38
  ...(config.webPlugins || []),
39
39
  {
40
- name: 'rebuild-notify',
40
+ name: "rebuild-notify",
41
41
  setup(build) {
42
- build.onEnd(result => {
42
+ build.onEnd((result) => {
43
43
  console.log(`web build ended with ${result.errors.length} errors`);
44
- console.log(result);
45
- result.errors.length !== 0 && process.exit(-1);
44
+ if (result.errors.length > 0) {
45
+ console.log(result);
46
+ }
47
+ // console.log(result);
48
+ // result.errors.length !== 0 && process.exit(-1);
46
49
  });
47
- }
50
+ },
48
51
  },
49
52
  ] });
50
53
  };
@@ -46,7 +46,14 @@ class BaseSuite {
46
46
  // @TODO fix me
47
47
  for (const k of Object.keys(this.givens)) {
48
48
  const giver = this.givens[k];
49
- giver.afterAll(this.store, artifactory, utils);
49
+ try {
50
+ giver.afterAll(this.store, artifactory, utils);
51
+ }
52
+ catch (e) {
53
+ console.error(e);
54
+ this.fails.push(giver);
55
+ return this;
56
+ }
50
57
  }
51
58
  ////////////////
52
59
  return this;
@@ -77,7 +84,7 @@ class BaseGiven {
77
84
  features: this.features,
78
85
  };
79
86
  }
80
- async afterEach(store, key, artifactory) {
87
+ async afterEach(store, key, artifactory, utils) {
81
88
  return store;
82
89
  }
83
90
  async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, utils) {
@@ -102,7 +109,7 @@ class BaseGiven {
102
109
  }
103
110
  finally {
104
111
  try {
105
- await this.afterEach(this.store, key, givenArtifactory);
112
+ await this.afterEach(this.store, key, givenArtifactory, utils);
106
113
  }
107
114
  catch (e) {
108
115
  console.error("afterEach failed! no error will be recorded!", e);
@@ -149,7 +156,7 @@ class BaseThen {
149
156
  async test(store, testResourceConfiguration, tLog, utils) {
150
157
  tLog(" Then:", this.name);
151
158
  try {
152
- const x = (await this.butThen(store, this.thenCB, testResourceConfiguration));
159
+ const x = await this.butThen(store, this.thenCB, testResourceConfiguration);
153
160
  return x;
154
161
  }
155
162
  catch (e) {
@@ -168,7 +175,7 @@ class BaseCheck {
168
175
  this.whens = whens;
169
176
  this.thens = thens;
170
177
  }
171
- async afterEach(store, key, cb) {
178
+ async afterEach(store, key, cb, utils) {
172
179
  return;
173
180
  }
174
181
  async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, utils) {
@@ -186,7 +193,7 @@ class BaseCheck {
186
193
  };
187
194
  return a;
188
195
  }, {}));
189
- await this.afterEach(store, key);
196
+ await this.afterEach(store, key, () => { }, utils);
190
197
  return;
191
198
  }
192
199
  }
@@ -32,33 +32,33 @@ class BaseBuilder {
32
32
  name: "",
33
33
  fs: ".",
34
34
  ports: [],
35
- scheduled: false
35
+ scheduled: false,
36
36
  }, y) {
37
37
  console.log(`testResourceConfiguration ${JSON.stringify(testResourceConfiguration, null, 2)}`);
38
- await logWriter.mkdirSync(testResourceConfiguration.fs);
38
+ // await logWriter.mkdirSync(testResourceConfiguration.fs);
39
+ // if (!fs.existsSync(destFolder)) {
40
+ // fs.mkdirSync(destFolder, { recursive: true });
41
+ // }
39
42
  logWriter.writeFileSync(`${testResourceConfiguration.fs}/tests.json`, JSON.stringify(this.toObj(), null, 2));
40
43
  const logFilePath = `${testResourceConfiguration.fs}/log.txt`;
41
44
  const access = await logWriter.createWriteStream(logFilePath);
42
- const tLog = (...l) => {
43
- // console.log(...l);
44
- access.write(`${l.toString()}\n`);
45
- };
45
+ const tLog = (...l) => access.write(`${l.toString()}\n`);
46
46
  const suiteDone = await runner(testResourceConfiguration, tLog, y);
47
- const resultsFilePath = (`${testResourceConfiguration.fs}/results.json`);
48
- logWriter.writeFileSync(resultsFilePath, JSON.stringify(suiteDone.toObj(), null, 2));
49
47
  const logPromise = new Promise((res, rej) => {
50
- access.on("finish", () => { res(true); });
48
+ access.on("finish", () => {
49
+ res(true);
50
+ });
51
51
  });
52
52
  access.end();
53
53
  const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
54
- // console.log(`suiteDone.givens[k].error`, suiteDone.givens[k].error);
55
54
  return suiteDone.givens[k].error;
56
55
  }).length;
56
+ logWriter.writeFileSync(`${testResourceConfiguration.fs}/exitcode`, numberOfFailures.toString());
57
57
  console.log(`exiting gracefully with ${numberOfFailures} failures.`);
58
58
  return {
59
59
  failed: numberOfFailures,
60
60
  artifacts: this.artifacts || [],
61
- logPromise
61
+ logPromise,
62
62
  };
63
63
  },
64
64
  };
@@ -10,10 +10,9 @@ class ClassBuilder extends basebuilder_js_1.BaseBuilder {
10
10
  };
11
11
  return a;
12
12
  }, {});
13
- const classyGivens = Object.entries(testImplementation.givens)
14
- .reduce((a, [key, givEn]) => {
13
+ const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, givEn]) => {
15
14
  a[key] = (features, whens, thens, givEn) => {
16
- return new (givenKlasser.prototype).constructor(key, features, whens, thens, testImplementation.givens[key], givEn);
15
+ return new givenKlasser.prototype.constructor(key, features, whens, thens, testImplementation.givens[key], givEn);
17
16
  };
18
17
  return a;
19
18
  }, {});
@@ -10,20 +10,49 @@ class Testeranto extends classBuilder_js_1.ClassBuilder {
10
10
  assertThat(t) {
11
11
  fullTestInterface.assertThis(t);
12
12
  }
13
- async setup(s, artifactory, tr) {
14
- return (fullTestInterface.beforeAll || (async (input, artifactory, tr) => input))(s, this.testResourceConfiguration, artifactory);
13
+ async setup(s, artifactory, tr, utils) {
14
+ return (fullTestInterface.beforeAll ||
15
+ (async (input, artifactory, tr, utils) => input))(s, this.testResourceConfiguration, artifactory, utils);
15
16
  }
16
17
  }, class Given extends abstractBase_js_1.BaseGiven {
17
18
  async givenThat(subject, testResource, artifactory, initializer) {
18
19
  return fullTestInterface.beforeEach(subject, initializer, (fPath, value) =>
19
20
  // TODO does not work?
20
- artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues);
21
+ artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues
22
+ // utils,
23
+ );
21
24
  }
22
- afterEach(store, key, artifactory) {
23
- return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value))));
25
+ afterEach(store, key, artifactory, utils) {
26
+ return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value), utils)));
24
27
  }
25
28
  afterAll(store, artifactory, utils) {
26
- return fullTestInterface.afterAll(store, (fPath, value) => { artifactory(`afterAll4-${this.name}/${fPath}`, value); }, utils);
29
+ const pagesHandler = {
30
+ get(target, prop) {
31
+ console.log(`Getting pages property ${prop}`);
32
+ return target[prop];
33
+ },
34
+ };
35
+ const browserHandler = {
36
+ get(target, prop) {
37
+ console.log(`Getting browser property ${prop}`);
38
+ if (prop === "pages") {
39
+ // return target[prop];
40
+ return new Proxy(target[prop], pagesHandler);
41
+ }
42
+ else {
43
+ return target[prop];
44
+ }
45
+ },
46
+ };
47
+ const proxy = new Proxy(utils.browser, browserHandler);
48
+ return fullTestInterface.afterAll(store, (fPath, value) => {
49
+ artifactory(`afterAll4-${this.name}/${fPath}`, value);
50
+ }, utils
51
+ // {
52
+ // ...utils,
53
+ // browser: proxy,
54
+ // }
55
+ );
27
56
  }
28
57
  }, class When extends abstractBase_js_1.BaseWhen {
29
58
  async andWhen(store, whenCB, testResource) {
@@ -41,10 +70,10 @@ class Testeranto extends classBuilder_js_1.ClassBuilder {
41
70
  async checkThat(subject, testResourceConfiguration, artifactory) {
42
71
  return fullTestInterface.beforeEach(subject, this.initialValues, (fPath, value) => artifactory(`before/${fPath}`, value), testResourceConfiguration, this.initialValues);
43
72
  }
44
- afterEach(store, key, artifactory) {
73
+ afterEach(store, key, artifactory, utils) {
45
74
  return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) =>
46
75
  // TODO does not work?
47
- artifactory(`afterEach2-${this.name}/${fPath}`, value))));
76
+ artifactory(`afterEach2-${this.name}/${fPath}`, value), utils)));
48
77
  }
49
78
  }, testResourceRequirement, logWriter);
50
79
  }
@@ -2,18 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultTestResourceRequirement = exports.DefaultTestInterface = exports.BaseTestInterface = void 0;
4
4
  exports.BaseTestInterface = {
5
- beforeAll: (async (s) => s),
6
- beforeEach: async function (subject, initialValues, testResource) { return subject; },
7
- afterEach: (async (s) => s),
8
- afterAll: ((store) => undefined),
9
- butThen: (async (store, thenCb) => thenCb(store)),
10
- andWhen: ((a) => a),
11
- assertThis: (() => null),
5
+ beforeAll: async (s) => s,
6
+ beforeEach: async function (subject, initialValues, testResource) {
7
+ return subject;
8
+ },
9
+ afterEach: async (s) => s,
10
+ afterAll: (store) => undefined,
11
+ butThen: async (store, thenCb) => thenCb(store),
12
+ andWhen: (a) => a,
13
+ assertThis: () => null,
12
14
  };
13
15
  const DefaultTestInterface = (p) => {
14
16
  return Object.assign(Object.assign({}, exports.BaseTestInterface), p);
15
17
  };
16
18
  exports.DefaultTestInterface = DefaultTestInterface;
17
19
  exports.defaultTestResourceRequirement = {
18
- ports: 0
20
+ ports: 0,
19
21
  };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,29 +1,19 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const electron_1 = require("electron");
4
- console.log("hello preloader");
6
+ const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
5
7
  const NodeWriter_1 = require("./NodeWriter");
8
+ const puppeteerConfiger_1 = __importDefault(require("./puppeteerConfiger"));
6
9
  window.NodeWriter = NodeWriter_1.NodeWriter;
7
- window.exit = (x) => {
8
- electron_1.ipcRenderer.invoke('quit-app', x);
9
- };
10
- // var oldLog = console.log;
11
- // console.log = function (message) {
12
- // ipcRenderer.invoke('web-log', message.toString());
13
- // oldLog.apply(console, arguments);
14
- // };
15
- // var oldLog = console.error;
16
- // console.error = function (message) {
17
- // ipcRenderer.invoke('web-error', message.toString());
18
- // oldLog.apply(console, arguments);
19
- // };
20
- // var oldLog = console.warn;
21
- // console.warn = function (message) {
22
- // ipcRenderer.invoke('web-warn', message.toString());
23
- // oldLog.apply(console, arguments);
24
- // };
25
- // var oldLog = console.info;
26
- // console.info = function (message) {
27
- // ipcRenderer.invoke('web-info', message.toString());
28
- // oldLog.apply(console, arguments);
29
- // };
10
+ window.browser = new Promise(async (res, rej) => {
11
+ const browser = await (0, puppeteerConfiger_1.default)("2999").then(async (json) => {
12
+ const b = await puppeteer_core_1.default.connect({
13
+ browserWSEndpoint: json.webSocketDebuggerUrl,
14
+ defaultViewport: null,
15
+ });
16
+ console.log("connected!", b.isConnected());
17
+ return res(b);
18
+ });
19
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const http_1 = __importDefault(require("http"));
7
+ exports.default = async (port) => new Promise((resolve, reject) => {
8
+ let json = "";
9
+ const request = http_1.default.request({
10
+ host: "127.0.0.1",
11
+ path: "/json/version",
12
+ port,
13
+ }, (response) => {
14
+ response.on("error", reject);
15
+ response.on("data", (chunk) => {
16
+ json += chunk.toString();
17
+ });
18
+ response.on("end", () => {
19
+ resolve(JSON.parse(json));
20
+ });
21
+ });
22
+ request.on("error", reject);
23
+ request.end();
24
+ });