testeranto 0.70.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 (94) hide show
  1. package/README.md +9 -18
  2. package/dist/common/Node.js +14 -34
  3. package/dist/common/PM/index.js +71 -0
  4. package/dist/common/PM/main.js +361 -0
  5. package/dist/common/PM/node.js +176 -0
  6. package/dist/common/PM/web.js +174 -0
  7. package/dist/common/Project.js +20 -2
  8. package/dist/common/Puppeteer.js +109 -0
  9. package/dist/common/Reporter.js +119 -0
  10. package/dist/common/Scheduler.js +1 -0
  11. package/dist/common/SubPackages/puppeteer.js +3 -1
  12. package/dist/common/SubPackages/react-dom/component/web.js +98 -45
  13. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -1
  14. package/dist/common/Web.js +24 -43
  15. package/dist/common/esbuildConfigs/web.js +3 -1
  16. package/dist/common/lib/abstractBase.js +189 -41
  17. package/dist/common/lib/basebuilder.js +56 -29
  18. package/dist/common/lib/classBuilder.js +6 -2
  19. package/dist/common/lib/core.js +41 -45
  20. package/dist/common/lib/index.js +2 -1
  21. package/dist/common/preload.js +14 -18
  22. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  23. package/dist/module/Node.js +14 -34
  24. package/dist/module/PM/index.js +67 -0
  25. package/dist/module/PM/main.js +331 -0
  26. package/dist/module/PM/node.js +168 -0
  27. package/dist/module/PM/web.js +167 -0
  28. package/dist/module/Project.js +20 -2
  29. package/dist/module/Puppeteer.js +104 -0
  30. package/dist/module/Reporter.js +114 -0
  31. package/dist/module/Scheduler.js +1 -0
  32. package/dist/module/SubPackages/puppeteer.js +3 -1
  33. package/dist/module/SubPackages/react/jsx/node.js +1 -1
  34. package/dist/module/SubPackages/react-dom/component/web.js +98 -45
  35. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -1
  36. package/dist/module/Web.js +24 -43
  37. package/dist/module/esbuildConfigs/web.js +3 -1
  38. package/dist/module/lib/abstractBase.js +189 -41
  39. package/dist/module/lib/basebuilder.js +56 -29
  40. package/dist/module/lib/classBuilder.js +6 -2
  41. package/dist/module/lib/core.js +41 -45
  42. package/dist/module/lib/index.js +2 -1
  43. package/dist/module/preload.js +15 -14
  44. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  45. package/dist/prebuild/Report.css +1616 -584
  46. package/dist/prebuild/Report.js +2635 -2506
  47. package/dist/types/PM/index.d.ts +19 -0
  48. package/dist/types/PM/main.d.ts +28 -0
  49. package/dist/types/PM/node.d.ts +26 -0
  50. package/dist/types/PM/web.d.ts +24 -0
  51. package/dist/types/Reporter.d.ts +1 -0
  52. package/dist/types/Scheduler.d.ts +0 -0
  53. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  54. package/dist/types/lib/abstractBase.d.ts +13 -12
  55. package/dist/types/lib/basebuilder.d.ts +4 -2
  56. package/dist/types/lib/classBuilder.d.ts +2 -2
  57. package/dist/types/lib/core.d.ts +4 -4
  58. package/dist/types/lib/index.d.ts +6 -5
  59. package/dist/types/lib/types.d.ts +16 -24
  60. package/dist/types/preload.d.ts +0 -1
  61. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  62. package/package.json +3 -5
  63. package/src/Node.ts +18 -43
  64. package/src/PM/index.ts +102 -0
  65. package/src/PM/main.ts +420 -0
  66. package/src/PM/node.ts +515 -0
  67. package/src/PM/web.ts +497 -0
  68. package/src/Project.ts +21 -2
  69. package/src/Puppeteer.ts +131 -0
  70. package/src/Report.tsx +158 -44
  71. package/src/Reporter.ts +134 -0
  72. package/src/Scheduler.ts +0 -0
  73. package/src/SubPackages/puppeteer.ts +3 -3
  74. package/src/SubPackages/react/jsx/node.ts +5 -8
  75. package/src/SubPackages/react-dom/component/web.ts +126 -67
  76. package/src/SubPackages/react-test-renderer/jsx/index.ts +0 -1
  77. package/src/Web.ts +25 -67
  78. package/src/esbuildConfigs/web.ts +4 -2
  79. package/src/lib/abstractBase.ts +260 -65
  80. package/src/lib/basebuilder.ts +121 -100
  81. package/src/lib/classBuilder.ts +5 -4
  82. package/src/lib/core.ts +58 -59
  83. package/src/lib/index.ts +10 -9
  84. package/src/lib/types.ts +18 -27
  85. package/src/preload.ts +14 -14
  86. package/dist/common/NodeWriter.js +0 -54
  87. package/dist/common/electron.js +0 -266
  88. package/dist/module/NodeWriter.js +0 -48
  89. package/dist/module/electron.js +0 -261
  90. package/dist/types/NodeWriter.d.ts +0 -2
  91. package/src/NodeWriter.ts +0 -72
  92. package/src/electron.ts +0 -317
  93. package/yarn-error.log +0 -3144
  94. /package/dist/types/{electron.d.ts → Puppeteer.d.ts} +0 -0
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseBuilder = void 0;
4
4
  class BaseBuilder {
5
- constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, logWriter, testResourceRequirement, testSpecification) {
5
+ constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, testResourceRequirement, testSpecification
6
+ // puppetMaster: PM
7
+ ) {
6
8
  this.input = input;
7
9
  this.artifacts = [];
8
10
  this.artifacts = [];
@@ -13,47 +15,72 @@ class BaseBuilder {
13
15
  this.thenOverides = thenOverides;
14
16
  this.checkOverides = checkOverides;
15
17
  this.testSpecification = testSpecification;
18
+ // this.puppetMaster = puppetMaster;
16
19
  this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
17
- const suiteRunner = (suite, utils) => async (testResourceConfiguration, tLog, utils) => {
18
- return await suite.run(input, testResourceConfiguration, (fPath, value) => logWriter.testArtiFactoryfileWriter(tLog, (p) => {
19
- this.artifacts.push(p);
20
- })(testResourceConfiguration.fs + "/" + fPath, value), tLog, utils);
21
- };
22
- this.testJobs = this.specs.map((suite, utils) => {
23
- const runner = suiteRunner(suite, utils);
20
+ this.testJobs = this.specs.map((suite) => {
21
+ const suiteRunner = (suite) => async (
22
+ // testResourceConfiguration: ITTestResourceConfiguration,
23
+ puppetMaster, tLog) => {
24
+ await puppetMaster.startPuppeteer({
25
+ browserWSEndpoint: puppetMaster.testResourceConfiguration.browserWSEndpoint,
26
+ }, puppetMaster.testResourceConfiguration.fs);
27
+ return await suite.run(input, puppetMaster.testResourceConfiguration, (fPath, value) => puppetMaster.testArtiFactoryfileWriter(tLog, (p) => {
28
+ this.artifacts.push(p);
29
+ })(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value), tLog, puppetMaster);
30
+ };
31
+ const runner = suiteRunner(suite);
24
32
  return {
25
33
  test: suite,
26
- testResourceRequirement,
34
+ // testResourceRequirement,
27
35
  toObj: () => {
28
36
  return suite.toObj();
29
37
  },
30
38
  runner,
31
- receiveTestResourceConfig: async function (testResourceConfiguration = {
32
- name: "",
33
- fs: ".",
34
- ports: [],
35
- scheduled: false,
36
- }, y) {
37
- console.log(`testResourceConfiguration ${JSON.stringify(testResourceConfiguration, null, 2)}`);
38
- // await logWriter.mkdirSync(testResourceConfiguration.fs);
39
- // if (!fs.existsSync(destFolder)) {
40
- // fs.mkdirSync(destFolder, { recursive: true });
39
+ receiveTestResourceConfig: async function (
40
+ // testResourceConfiguration = {
41
+ // name: "",
42
+ // fs: ".",
43
+ // ports: [],
44
+ // browserWSEndpoint: "",
45
+ // },
46
+ puppetMaster) {
47
+ // console.log(
48
+ // `testResourceConfiguration! ${JSON.stringify(
49
+ // testResourceConfiguration,
50
+ // null,
51
+ // 2
52
+ // )}`
53
+ // );
54
+ // console.log("puppetMaster", puppetMaster);
55
+ await puppetMaster
56
+ .mkdirSync();
57
+ // if (!puppetMaster.existsSync(destFolder)) {
58
+ // puppetMaster.mkdirSync(destFolder, { recursive: true });
41
59
  // }
42
- logWriter.writeFileSync(`${testResourceConfiguration.fs}/tests.json`, JSON.stringify(this.toObj(), null, 2));
43
- const logFilePath = `${testResourceConfiguration.fs}/log.txt`;
44
- const access = await logWriter.createWriteStream(logFilePath);
45
- const tLog = (...l) => access.write(`${l.toString()}\n`);
46
- const suiteDone = await runner(testResourceConfiguration, tLog, y);
60
+ // puppetMaster.writeFileSync(
61
+ // // puppetMaster.testResourceConfiguration.fs + `/tests.json`,
62
+ // `tests.json`,
63
+ // JSON.stringify(this.toObj(), null, 2)
64
+ // );
65
+ const logFilePath = "log.txt";
66
+ // puppetMaster.testResourceConfiguration.fs + `/log.txt`;
67
+ const access = await puppetMaster.createWriteStream(logFilePath);
68
+ // console.log("access", access);
69
+ const tLog = (...l) => {
70
+ // access.write(`${l.toString()}\n`);
71
+ // console.log("tLog", l);
72
+ puppetMaster.write(access, `${l.toString()}\n`);
73
+ };
74
+ const suiteDone = await runner(puppetMaster, tLog);
47
75
  const logPromise = new Promise((res, rej) => {
48
- access.on("finish", () => {
49
- res(true);
50
- });
76
+ puppetMaster.end(access);
77
+ res(true);
51
78
  });
52
- access.end();
53
79
  const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
54
80
  return suiteDone.givens[k].error;
55
81
  }).length;
56
- logWriter.writeFileSync(`${testResourceConfiguration.fs}/exitcode`, numberOfFailures.toString());
82
+ puppetMaster.writeFileSync(`exitcode`, numberOfFailures.toString());
83
+ puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
57
84
  console.log(`exiting gracefully with ${numberOfFailures} failures.`);
58
85
  return {
59
86
  failed: numberOfFailures,
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClassBuilder = void 0;
4
4
  const basebuilder_js_1 = require("./basebuilder.js");
5
5
  class ClassBuilder extends basebuilder_js_1.BaseBuilder {
6
- constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement, logWriter) {
6
+ constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement
7
+ // puppetMaster: PM
8
+ ) {
7
9
  const classySuites = Object.entries(testImplementation.suites).reduce((a, [key], index) => {
8
10
  a[key] = (somestring, givens, checks) => {
9
11
  return new suiteKlasser.prototype.constructor(somestring, index, givens, checks);
@@ -34,7 +36,9 @@ class ClassBuilder extends basebuilder_js_1.BaseBuilder {
34
36
  };
35
37
  return a;
36
38
  }, {});
37
- super(input, classySuites, classyGivens, classyWhens, classyThens, classyChecks, logWriter, testResourceRequirement, testSpecification);
39
+ super(input, classySuites, classyGivens, classyWhens, classyThens, classyChecks, testResourceRequirement, testSpecification
40
+ // puppetMaster
41
+ );
38
42
  }
39
43
  }
40
44
  exports.ClassBuilder = ClassBuilder;
@@ -4,59 +4,53 @@ const index_js_1 = require("./index.js");
4
4
  const abstractBase_js_1 = require("./abstractBase.js");
5
5
  const classBuilder_js_1 = require("./classBuilder.js");
6
6
  class Testeranto extends classBuilder_js_1.ClassBuilder {
7
- constructor(input, testSpecification, testImplementation, testResourceRequirement = index_js_1.defaultTestResourceRequirement, logWriter, testInterface) {
7
+ constructor(input, testSpecification, testImplementation, testResourceRequirement = index_js_1.defaultTestResourceRequirement, testInterface
8
+ // puppetMaster: PM
9
+ ) {
8
10
  const fullTestInterface = (0, index_js_1.DefaultTestInterface)(testInterface);
9
11
  super(testImplementation, testSpecification, input, class extends abstractBase_js_1.BaseSuite {
12
+ afterAll(store, artifactory, pm) {
13
+ // const pagesHandler = {
14
+ // get(target, prop) {
15
+ // console.log(`Getting pages property ${prop}`);
16
+ // return target[prop];
17
+ // },
18
+ // };
19
+ // const browserHandler = {
20
+ // get(target, prop) {
21
+ // console.log(`Getting browser property ${prop}`);
22
+ // if (prop === "pages") {
23
+ // // return target[prop];
24
+ // return new Proxy(target[prop], pagesHandler);
25
+ // } else {
26
+ // return target[prop];
27
+ // }
28
+ // },
29
+ // };
30
+ // const proxy = new Proxy(utils.browser, browserHandler);
31
+ return fullTestInterface.afterAll(store, (fPath, value) => {
32
+ artifactory(`afterAll4-${this.name}/${fPath}`, value);
33
+ }, pm);
34
+ }
10
35
  assertThat(t) {
11
36
  fullTestInterface.assertThis(t);
12
37
  }
13
- async setup(s, artifactory, tr, utils) {
38
+ async setup(s, artifactory, tr, pm) {
14
39
  return (fullTestInterface.beforeAll ||
15
- (async (input, artifactory, tr, utils) => input))(s, this.testResourceConfiguration, artifactory, utils);
40
+ (async (input, artifactory, tr, pm) => input))(s, this.testResourceConfiguration, artifactory, pm);
16
41
  }
17
42
  }, class Given extends abstractBase_js_1.BaseGiven {
18
- async givenThat(subject, testResource, artifactory, initializer) {
43
+ async givenThat(subject, testResource, artifactory, initializer, pm) {
19
44
  return fullTestInterface.beforeEach(subject, initializer, (fPath, value) =>
20
45
  // TODO does not work?
21
- artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues
22
- // utils,
23
- );
46
+ artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues, pm);
24
47
  }
25
- afterEach(store, key, artifactory, utils) {
26
- return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value), utils)));
27
- }
28
- afterAll(store, artifactory, 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
- );
48
+ afterEach(store, key, artifactory, pm) {
49
+ return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value), pm)));
56
50
  }
57
51
  }, class When extends abstractBase_js_1.BaseWhen {
58
- async andWhen(store, whenCB, testResource) {
59
- return await fullTestInterface.andWhen(store, whenCB, testResource);
52
+ async andWhen(store, whenCB, testResource, pm) {
53
+ return await fullTestInterface.andWhen(store, whenCB, testResource, pm);
60
54
  }
61
55
  }, class Then extends abstractBase_js_1.BaseThen {
62
56
  async butThen(store, thenCB, testResourceConfiguration) {
@@ -67,15 +61,17 @@ class Testeranto extends classBuilder_js_1.ClassBuilder {
67
61
  super(name, features, checkCallback, whens, thens);
68
62
  this.initialValues = initialValues;
69
63
  }
70
- async checkThat(subject, testResourceConfiguration, artifactory) {
71
- return fullTestInterface.beforeEach(subject, this.initialValues, (fPath, value) => artifactory(`before/${fPath}`, value), testResourceConfiguration, this.initialValues);
64
+ async checkThat(subject, testResourceConfiguration, artifactory, pm) {
65
+ return fullTestInterface.beforeEach(subject, this.initialValues, (fPath, value) => artifactory(`before/${fPath}`, value), testResourceConfiguration, this.initialValues, pm);
72
66
  }
73
- afterEach(store, key, artifactory, utils) {
67
+ afterEach(store, key, artifactory, pm) {
74
68
  return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) =>
75
69
  // TODO does not work?
76
- artifactory(`afterEach2-${this.name}/${fPath}`, value), utils)));
70
+ artifactory(`afterEach2-${this.name}/${fPath}`, value), pm)));
77
71
  }
78
- }, testResourceRequirement, logWriter);
72
+ }, testResourceRequirement
73
+ // puppetMaster
74
+ );
79
75
  }
80
76
  }
81
77
  exports.default = Testeranto;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultTestResourceRequirement = exports.DefaultTestInterface = exports.BaseTestInterface = void 0;
4
+ // import { INodeUtils, ITestInterface, IUtils, IWebUtils } from "./types.js";
4
5
  exports.BaseTestInterface = {
5
6
  beforeAll: async (s) => s,
6
- beforeEach: async function (subject, initialValues, testResource) {
7
+ beforeEach: async function (subject, initialValues, x, testResource, pm) {
7
8
  return subject;
8
9
  },
9
10
  afterEach: async (s) => s,
@@ -1,19 +1,15 @@
1
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 puppeteer_core_1 = __importDefault(require("puppeteer-core"));
7
- const NodeWriter_1 = require("./NodeWriter");
8
- const puppeteerConfiger_1 = __importDefault(require("./puppeteerConfiger"));
9
- window.NodeWriter = NodeWriter_1.NodeWriter;
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
- });
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
+ // });