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.
- package/README.md +9 -18
- package/dist/common/Node.js +14 -34
- package/dist/common/PM/index.js +71 -0
- package/dist/common/PM/main.js +361 -0
- package/dist/common/PM/node.js +176 -0
- package/dist/common/PM/web.js +174 -0
- package/dist/common/Project.js +20 -2
- package/dist/common/Puppeteer.js +109 -0
- package/dist/common/Reporter.js +119 -0
- package/dist/common/Scheduler.js +1 -0
- package/dist/common/SubPackages/puppeteer.js +3 -1
- package/dist/common/SubPackages/react-dom/component/web.js +98 -45
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -1
- package/dist/common/Web.js +24 -43
- package/dist/common/esbuildConfigs/web.js +3 -1
- package/dist/common/lib/abstractBase.js +189 -41
- package/dist/common/lib/basebuilder.js +56 -29
- package/dist/common/lib/classBuilder.js +6 -2
- package/dist/common/lib/core.js +41 -45
- package/dist/common/lib/index.js +2 -1
- package/dist/common/preload.js +14 -18
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +14 -34
- package/dist/module/PM/index.js +67 -0
- package/dist/module/PM/main.js +331 -0
- package/dist/module/PM/node.js +168 -0
- package/dist/module/PM/web.js +167 -0
- package/dist/module/Project.js +20 -2
- package/dist/module/Puppeteer.js +104 -0
- package/dist/module/Reporter.js +114 -0
- package/dist/module/Scheduler.js +1 -0
- package/dist/module/SubPackages/puppeteer.js +3 -1
- package/dist/module/SubPackages/react/jsx/node.js +1 -1
- package/dist/module/SubPackages/react-dom/component/web.js +98 -45
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -1
- package/dist/module/Web.js +24 -43
- package/dist/module/esbuildConfigs/web.js +3 -1
- package/dist/module/lib/abstractBase.js +189 -41
- package/dist/module/lib/basebuilder.js +56 -29
- package/dist/module/lib/classBuilder.js +6 -2
- package/dist/module/lib/core.js +41 -45
- package/dist/module/lib/index.js +2 -1
- package/dist/module/preload.js +15 -14
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Report.css +1616 -584
- package/dist/prebuild/Report.js +2635 -2506
- package/dist/types/PM/index.d.ts +19 -0
- package/dist/types/PM/main.d.ts +28 -0
- package/dist/types/PM/node.d.ts +26 -0
- package/dist/types/PM/web.d.ts +24 -0
- package/dist/types/Reporter.d.ts +1 -0
- package/dist/types/Scheduler.d.ts +0 -0
- package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +13 -12
- package/dist/types/lib/basebuilder.d.ts +4 -2
- package/dist/types/lib/classBuilder.d.ts +2 -2
- package/dist/types/lib/core.d.ts +4 -4
- package/dist/types/lib/index.d.ts +6 -5
- package/dist/types/lib/types.d.ts +16 -24
- package/dist/types/preload.d.ts +0 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -5
- package/src/Node.ts +18 -43
- package/src/PM/index.ts +102 -0
- package/src/PM/main.ts +420 -0
- package/src/PM/node.ts +515 -0
- package/src/PM/web.ts +497 -0
- package/src/Project.ts +21 -2
- package/src/Puppeteer.ts +131 -0
- package/src/Report.tsx +158 -44
- package/src/Reporter.ts +134 -0
- package/src/Scheduler.ts +0 -0
- package/src/SubPackages/puppeteer.ts +3 -3
- package/src/SubPackages/react/jsx/node.ts +5 -8
- package/src/SubPackages/react-dom/component/web.ts +126 -67
- package/src/SubPackages/react-test-renderer/jsx/index.ts +0 -1
- package/src/Web.ts +25 -67
- package/src/esbuildConfigs/web.ts +4 -2
- package/src/lib/abstractBase.ts +260 -65
- package/src/lib/basebuilder.ts +121 -100
- package/src/lib/classBuilder.ts +5 -4
- package/src/lib/core.ts +58 -59
- package/src/lib/index.ts +10 -9
- package/src/lib/types.ts +18 -27
- package/src/preload.ts +14 -14
- package/dist/common/NodeWriter.js +0 -54
- package/dist/common/electron.js +0 -266
- package/dist/module/NodeWriter.js +0 -48
- package/dist/module/electron.js +0 -261
- package/dist/types/NodeWriter.d.ts +0 -2
- package/src/NodeWriter.ts +0 -72
- package/src/electron.ts +0 -317
- package/yarn-error.log +0 -3144
- /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,
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
//
|
|
40
|
-
//
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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
|
|
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,
|
|
39
|
+
super(input, classySuites, classyGivens, classyWhens, classyThens, classyChecks, testResourceRequirement, testSpecification
|
|
40
|
+
// puppetMaster
|
|
41
|
+
);
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
exports.ClassBuilder = ClassBuilder;
|
package/dist/common/lib/core.js
CHANGED
|
@@ -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,
|
|
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,
|
|
38
|
+
async setup(s, artifactory, tr, pm) {
|
|
14
39
|
return (fullTestInterface.beforeAll ||
|
|
15
|
-
(async (input, artifactory, tr,
|
|
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,
|
|
26
|
-
return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value),
|
|
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,
|
|
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),
|
|
70
|
+
artifactory(`afterEach2-${this.name}/${fPath}`, value), pm)));
|
|
77
71
|
}
|
|
78
|
-
}, testResourceRequirement
|
|
72
|
+
}, testResourceRequirement
|
|
73
|
+
// puppetMaster
|
|
74
|
+
);
|
|
79
75
|
}
|
|
80
76
|
}
|
|
81
77
|
exports.default = Testeranto;
|
package/dist/common/lib/index.js
CHANGED
|
@@ -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,
|
package/dist/common/preload.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
// });
|