testeranto 0.49.10 → 0.62.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/.nvmrc +1 -0
- package/README.md +71 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +53 -61
- package/dist/common/Project.js +272 -606
- package/dist/common/SubPackages/puppeteer.js +19 -0
- package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
- package/dist/common/SubPackages/react/jsx/index.js +13 -0
- package/dist/common/SubPackages/react/jsx/node.js +10 -0
- package/dist/common/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/component/node.js +6 -6
- package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +5 -14
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +26 -15
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
- package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
- package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +32 -0
- package/dist/common/Web.js +41 -112
- package/dist/common/electron.js +188 -44
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +35 -0
- package/dist/common/esbuildConfigs/report.js +48 -0
- package/dist/common/esbuildConfigs/tests.js +14 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/lib/abstractBase.js +193 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/browser.js +26 -0
- package/dist/common/lib/classBuilder.js +41 -0
- package/dist/common/lib/core.js +52 -0
- package/dist/common/lib/index.js +19 -0
- package/dist/common/nodeWriterElectron.js +55 -0
- package/dist/common/preload.js +22 -21
- package/dist/common/report.html.js +31 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/web.html.js +22 -0
- package/dist/module/Features.js +2 -3
- package/dist/module/Node.js +53 -61
- package/dist/module/Project.js +272 -583
- package/dist/module/SubPackages/puppeteer.js +14 -0
- package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
- package/dist/module/SubPackages/react/jsx/index.js +10 -0
- package/dist/module/SubPackages/react/jsx/node.js +5 -0
- package/dist/module/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +5 -5
- package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +4 -13
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +23 -15
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +30 -1
- package/dist/module/Web.js +41 -112
- package/dist/module/electron.js +189 -45
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +30 -0
- package/dist/module/esbuildConfigs/report.js +48 -0
- package/dist/module/esbuildConfigs/tests.js +12 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/lib/abstractBase.js +185 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/browser.js +22 -0
- package/dist/module/lib/classBuilder.js +37 -0
- package/dist/module/lib/core.js +49 -0
- package/dist/module/lib/index.js +15 -0
- package/dist/module/nodeWriterElectron.js +52 -0
- package/dist/module/preload.js +22 -21
- package/dist/module/report.html.js +29 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/Report.css +10326 -0
- package/dist/prebuild/Report.js +37456 -0
- package/dist/types/Features.d.ts +5 -5
- package/dist/types/Node.d.ts +4 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -27
- package/dist/types/SubPackages/puppeteer.d.ts +6 -0
- package/dist/types/SubPackages/react/component/node.d.ts +7 -0
- package/dist/types/SubPackages/react/component/web.d.ts +7 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +15 -0
- package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/{subPackages → SubPackages}/react-dom/component/node.d.ts +2 -4
- package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
- package/dist/types/Types.d.ts +116 -3
- package/dist/types/Web.d.ts +4 -11
- package/dist/types/esbuildConfigs/features.d.ts +4 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/report.d.ts +0 -0
- package/dist/types/esbuildConfigs/tests.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/lib/abstractBase.d.ts +102 -0
- package/dist/types/lib/basebuilder.d.ts +24 -0
- package/dist/types/lib/browser.d.ts +6 -0
- package/dist/types/lib/classBuilder.d.ts +6 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +57 -0
- package/dist/types/nodeWriterElectron.d.ts +2 -0
- package/dist/types/report.html.d.ts +2 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/web.html.d.ts +2 -0
- package/electronBuild.ts +32 -0
- package/index.html +30 -0
- package/package.json +120 -85
- package/src/Features.ts +2 -4
- package/src/Node.ts +114 -160
- package/src/NodeWriter.ts +1 -4
- package/src/Project.ts +610 -753
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +46 -0
- package/src/{subPackages → SubPackages}/react/component/node.ts +12 -32
- package/src/SubPackages/react/component/web.ts +53 -0
- package/src/SubPackages/react/jsx/index.ts +43 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +28 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +11 -25
- package/src/{subPackages → SubPackages}/react-dom/component/web.ts +27 -32
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +18 -54
- package/src/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.ts +9 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +31 -29
- package/src/SubPackages/react-test-renderer/component/node.ts +22 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +22 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/node.ts +14 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/web.ts +9 -25
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx/index.ts +19 -16
- package/src/SubPackages/react-test-renderer/jsx/node.ts +24 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +7 -15
- package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
- package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
- package/src/Types.ts +334 -3
- package/src/Web.ts +104 -230
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +237 -46
- package/src/esbuildConfigs/features.ts +18 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +59 -0
- package/src/esbuildConfigs/report.ts +51 -0
- package/src/esbuildConfigs/tests.ts +20 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +459 -0
- package/src/lib/basebuilder.ts +253 -0
- package/src/lib/browser.ts +34 -0
- package/src/lib/classBuilder.ts +137 -0
- package/src/lib/core.ts +182 -0
- package/src/lib/index.ts +116 -0
- package/src/nodeWriterElectron.ts +71 -0
- package/src/preload.ts +23 -21
- package/src/report.html.ts +29 -0
- package/src/web.html.ts +20 -0
- package/tests/Rectangle.test.ts +189 -0
- package/tsconfig.json +19 -6
- package/tsconfig.module.json +15 -4
- package/tsconfig.types.json +14 -4
- package/yarn-error.log +3144 -0
- package/dist/common/core.js +0 -397
- package/dist/common/subPackages/react/jsx/index.js +0 -26
- package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
- package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
- package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
- package/dist/module/Report.js +0 -186
- package/dist/module/core.js +0 -388
- package/dist/module/subPackages/react/jsx/index.js +0 -22
- package/dist/module/subPackages/react/jsx/node.js +0 -5
- package/dist/module/subPackages/react/jsx/web.js +0 -5
- package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
- package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
- package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
- package/dist/types/core.d.ts +0 -220
- package/dist/types/subPackages/react/component/node.d.ts +0 -12
- package/dist/types/subPackages/react/component/web.d.ts +0 -12
- package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
- package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
- package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
- package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
- package/dist/types/subPackages/react-test-renderer/component/node.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
- package/src/core.ts +0 -1399
- package/src/subPackages/react/component/web.ts +0 -80
- package/src/subPackages/react/jsx/index.ts +0 -64
- package/src/subPackages/react/jsx/node.ts +0 -29
- package/src/subPackages/react/jsx/web.ts +0 -29
- package/src/subPackages/react-dom/jsx/node.ts +0 -145
- package/src/subPackages/react-test-renderer/component/node.ts +0 -30
- package/src/subPackages/react-test-renderer/component/web.ts +0 -30
- package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
- /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseCheck = exports.BaseThen = exports.BaseWhen = exports.BaseGiven = exports.BaseSuite = void 0;
|
|
4
|
+
class BaseSuite {
|
|
5
|
+
constructor(name, index, givens = {}, checks = []) {
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.index = index;
|
|
8
|
+
this.givens = givens;
|
|
9
|
+
this.checks = checks;
|
|
10
|
+
this.fails = [];
|
|
11
|
+
}
|
|
12
|
+
toObj() {
|
|
13
|
+
return {
|
|
14
|
+
name: this.name,
|
|
15
|
+
givens: Object.keys(this.givens).map((k) => this.givens[k].toObj()),
|
|
16
|
+
fails: this.fails,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
setup(s, artifactory, tr, utils) {
|
|
20
|
+
return new Promise((res) => res(s));
|
|
21
|
+
}
|
|
22
|
+
assertThat(t) {
|
|
23
|
+
// console.log("base assertThat")
|
|
24
|
+
return t;
|
|
25
|
+
}
|
|
26
|
+
async run(input, testResourceConfiguration, artifactory, tLog, utils) {
|
|
27
|
+
this.testResourceConfiguration = testResourceConfiguration;
|
|
28
|
+
tLog("test resources: ", testResourceConfiguration);
|
|
29
|
+
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
30
|
+
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, utils);
|
|
31
|
+
tLog("\nSuite:", this.index, this.name);
|
|
32
|
+
for (const k of Object.keys(this.givens)) {
|
|
33
|
+
const giver = this.givens[k];
|
|
34
|
+
try {
|
|
35
|
+
this.store = await giver.give(subject, k, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, utils);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
console.error(e);
|
|
39
|
+
this.fails.push(giver);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (const [ndx, thater] of this.checks.entries()) {
|
|
44
|
+
await thater.check(subject, thater.name, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, utils);
|
|
45
|
+
}
|
|
46
|
+
// @TODO fix me
|
|
47
|
+
for (const k of Object.keys(this.givens)) {
|
|
48
|
+
const giver = this.givens[k];
|
|
49
|
+
giver.afterAll(this.store, artifactory, utils);
|
|
50
|
+
}
|
|
51
|
+
////////////////
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.BaseSuite = BaseSuite;
|
|
56
|
+
class BaseGiven {
|
|
57
|
+
constructor(name, features, whens, thens, givenCB, initialValues) {
|
|
58
|
+
this.name = name;
|
|
59
|
+
this.features = features;
|
|
60
|
+
this.whens = whens;
|
|
61
|
+
this.thens = thens;
|
|
62
|
+
this.givenCB = givenCB;
|
|
63
|
+
this.initialValues = initialValues;
|
|
64
|
+
}
|
|
65
|
+
beforeAll(store, artifactory) {
|
|
66
|
+
return store;
|
|
67
|
+
}
|
|
68
|
+
afterAll(store, artifactory, utils) {
|
|
69
|
+
return store;
|
|
70
|
+
}
|
|
71
|
+
toObj() {
|
|
72
|
+
return {
|
|
73
|
+
name: this.name,
|
|
74
|
+
whens: this.whens.map((w) => w.toObj()),
|
|
75
|
+
thens: this.thens.map((t) => t.toObj()),
|
|
76
|
+
error: this.error ? [this.error, this.error.stack] : null,
|
|
77
|
+
features: this.features,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
async afterEach(store, key, artifactory) {
|
|
81
|
+
return store;
|
|
82
|
+
}
|
|
83
|
+
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, utils) {
|
|
84
|
+
tLog(`\n Given: ${this.name}`);
|
|
85
|
+
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
86
|
+
try {
|
|
87
|
+
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB);
|
|
88
|
+
// tLog(`\n Given this.store`, this.store);
|
|
89
|
+
for (const whenStep of this.whens) {
|
|
90
|
+
await whenStep.test(this.store, testResourceConfiguration, tLog, utils);
|
|
91
|
+
}
|
|
92
|
+
for (const thenStep of this.thens) {
|
|
93
|
+
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, utils);
|
|
94
|
+
tester(t);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
this.error = e;
|
|
99
|
+
tLog(e);
|
|
100
|
+
tLog("\u0007"); // bell
|
|
101
|
+
// throw e;
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
try {
|
|
105
|
+
await this.afterEach(this.store, key, givenArtifactory);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
console.error("afterEach failed! no error will be recorded!", e);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return this.store;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.BaseGiven = BaseGiven;
|
|
115
|
+
class BaseWhen {
|
|
116
|
+
constructor(name, whenCB) {
|
|
117
|
+
this.name = name;
|
|
118
|
+
this.whenCB = whenCB;
|
|
119
|
+
}
|
|
120
|
+
toObj() {
|
|
121
|
+
return {
|
|
122
|
+
name: this.name,
|
|
123
|
+
error: this.error,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
async test(store, testResourceConfiguration, tLog, utils) {
|
|
127
|
+
tLog(" When:", this.name);
|
|
128
|
+
try {
|
|
129
|
+
return await this.andWhen(store, this.whenCB, testResourceConfiguration);
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
this.error = true;
|
|
133
|
+
throw e;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.BaseWhen = BaseWhen;
|
|
138
|
+
class BaseThen {
|
|
139
|
+
constructor(name, thenCB) {
|
|
140
|
+
this.name = name;
|
|
141
|
+
this.thenCB = thenCB;
|
|
142
|
+
}
|
|
143
|
+
toObj() {
|
|
144
|
+
return {
|
|
145
|
+
name: this.name,
|
|
146
|
+
error: this.error,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
async test(store, testResourceConfiguration, tLog, utils) {
|
|
150
|
+
tLog(" Then:", this.name);
|
|
151
|
+
try {
|
|
152
|
+
const x = (await this.butThen(store, this.thenCB, testResourceConfiguration));
|
|
153
|
+
return x;
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
console.log("test failed", e);
|
|
157
|
+
this.error = true;
|
|
158
|
+
throw e;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.BaseThen = BaseThen;
|
|
163
|
+
class BaseCheck {
|
|
164
|
+
constructor(name, features, checkCB, whens, thens) {
|
|
165
|
+
this.name = name;
|
|
166
|
+
this.features = features;
|
|
167
|
+
this.checkCB = checkCB;
|
|
168
|
+
this.whens = whens;
|
|
169
|
+
this.thens = thens;
|
|
170
|
+
}
|
|
171
|
+
async afterEach(store, key, cb) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, utils) {
|
|
175
|
+
tLog(`\n Check: ${this.name}`);
|
|
176
|
+
const store = await this.checkThat(subject, testResourceConfiguration, artifactory);
|
|
177
|
+
await this.checkCB(Object.entries(this.whens).reduce((a, [key, when]) => {
|
|
178
|
+
a[key] = async (payload) => {
|
|
179
|
+
return await when(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, utils);
|
|
180
|
+
};
|
|
181
|
+
return a;
|
|
182
|
+
}, {}), Object.entries(this.thens).reduce((a, [key, then]) => {
|
|
183
|
+
a[key] = async (payload) => {
|
|
184
|
+
const t = await then(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, utils);
|
|
185
|
+
tester(t);
|
|
186
|
+
};
|
|
187
|
+
return a;
|
|
188
|
+
}, {}));
|
|
189
|
+
await this.afterEach(store, key);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.BaseCheck = BaseCheck;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseBuilder = void 0;
|
|
4
|
+
class BaseBuilder {
|
|
5
|
+
constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, logWriter, testResourceRequirement, testSpecification) {
|
|
6
|
+
this.input = input;
|
|
7
|
+
this.artifacts = [];
|
|
8
|
+
this.artifacts = [];
|
|
9
|
+
this.testResourceRequirement = testResourceRequirement;
|
|
10
|
+
this.suitesOverrides = suitesOverrides;
|
|
11
|
+
this.givenOverides = givenOverides;
|
|
12
|
+
this.whenOverides = whenOverides;
|
|
13
|
+
this.thenOverides = thenOverides;
|
|
14
|
+
this.checkOverides = checkOverides;
|
|
15
|
+
this.testSpecification = testSpecification;
|
|
16
|
+
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);
|
|
24
|
+
return {
|
|
25
|
+
test: suite,
|
|
26
|
+
testResourceRequirement,
|
|
27
|
+
toObj: () => {
|
|
28
|
+
return suite.toObj();
|
|
29
|
+
},
|
|
30
|
+
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
|
+
logWriter.writeFileSync(`${testResourceConfiguration.fs}/tests.json`, JSON.stringify(this.toObj(), null, 2));
|
|
40
|
+
const logFilePath = `${testResourceConfiguration.fs}/log.txt`;
|
|
41
|
+
const access = await logWriter.createWriteStream(logFilePath);
|
|
42
|
+
const tLog = (...l) => {
|
|
43
|
+
// console.log(...l);
|
|
44
|
+
access.write(`${l.toString()}\n`);
|
|
45
|
+
};
|
|
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
|
+
const logPromise = new Promise((res, rej) => {
|
|
50
|
+
access.on("finish", () => { res(true); });
|
|
51
|
+
});
|
|
52
|
+
access.end();
|
|
53
|
+
const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
|
|
54
|
+
// console.log(`suiteDone.givens[k].error`, suiteDone.givens[k].error);
|
|
55
|
+
return suiteDone.givens[k].error;
|
|
56
|
+
}).length;
|
|
57
|
+
console.log(`exiting gracefully with ${numberOfFailures} failures.`);
|
|
58
|
+
return {
|
|
59
|
+
failed: numberOfFailures,
|
|
60
|
+
artifacts: this.artifacts || [],
|
|
61
|
+
logPromise
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
Specs() {
|
|
68
|
+
return this.specs;
|
|
69
|
+
}
|
|
70
|
+
Suites() {
|
|
71
|
+
return this.suitesOverrides;
|
|
72
|
+
}
|
|
73
|
+
Given() {
|
|
74
|
+
return this.givenOverides;
|
|
75
|
+
}
|
|
76
|
+
When() {
|
|
77
|
+
return this.whenOverides;
|
|
78
|
+
}
|
|
79
|
+
Then() {
|
|
80
|
+
return this.thenOverides;
|
|
81
|
+
}
|
|
82
|
+
Check() {
|
|
83
|
+
return this.checkOverides;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.BaseBuilder = BaseBuilder;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TBrowser = void 0;
|
|
4
|
+
class TBrowser {
|
|
5
|
+
constructor(browser) {
|
|
6
|
+
this.browser = browser;
|
|
7
|
+
}
|
|
8
|
+
pages() {
|
|
9
|
+
return new Promise(async (res, rej) => {
|
|
10
|
+
res((await this.browser.pages()).map((p) => {
|
|
11
|
+
// const handler = {
|
|
12
|
+
// apply: function (target, thisArg, argumentsList) {
|
|
13
|
+
// console.log('screenshot was called with ' + JSON.stringify(argumentsList));
|
|
14
|
+
// const x: ScreenshotOptions = argumentsList[0]
|
|
15
|
+
// x.path = "./dist/" + x.path;
|
|
16
|
+
// console.log('x.path' + x.path, target, thisArg);
|
|
17
|
+
// return target(...argumentsList);
|
|
18
|
+
// }
|
|
19
|
+
// };
|
|
20
|
+
// p.screenshot = new Proxy(p.screenshot, handler);
|
|
21
|
+
return p;
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.TBrowser = TBrowser;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClassBuilder = void 0;
|
|
4
|
+
const basebuilder_js_1 = require("./basebuilder.js");
|
|
5
|
+
class ClassBuilder extends basebuilder_js_1.BaseBuilder {
|
|
6
|
+
constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement, logWriter) {
|
|
7
|
+
const classySuites = Object.entries(testImplementation.suites).reduce((a, [key], index) => {
|
|
8
|
+
a[key] = (somestring, givens, checks) => {
|
|
9
|
+
return new suiteKlasser.prototype.constructor(somestring, index, givens, checks);
|
|
10
|
+
};
|
|
11
|
+
return a;
|
|
12
|
+
}, {});
|
|
13
|
+
const classyGivens = Object.entries(testImplementation.givens)
|
|
14
|
+
.reduce((a, [key, givEn]) => {
|
|
15
|
+
a[key] = (features, whens, thens, givEn) => {
|
|
16
|
+
return new (givenKlasser.prototype).constructor(key, features, whens, thens, testImplementation.givens[key], givEn);
|
|
17
|
+
};
|
|
18
|
+
return a;
|
|
19
|
+
}, {});
|
|
20
|
+
const classyWhens = Object.entries(testImplementation.whens).reduce((a, [key, whEn]) => {
|
|
21
|
+
a[key] = (payload) => {
|
|
22
|
+
return new whenKlasser.prototype.constructor(`${whEn.name}: ${payload && payload.toString()}`, whEn(payload));
|
|
23
|
+
};
|
|
24
|
+
return a;
|
|
25
|
+
}, {});
|
|
26
|
+
const classyThens = Object.entries(testImplementation.thens).reduce((a, [key, thEn]) => {
|
|
27
|
+
a[key] = (expected, x) => {
|
|
28
|
+
return new thenKlasser.prototype.constructor(`${thEn.name}: ${expected && expected.toString()}`, thEn(expected));
|
|
29
|
+
};
|
|
30
|
+
return a;
|
|
31
|
+
}, {});
|
|
32
|
+
const classyChecks = Object.entries(testImplementation.checks).reduce((a, [key, z]) => {
|
|
33
|
+
a[key] = (somestring, features, callback) => {
|
|
34
|
+
return new checkKlasser.prototype.constructor(somestring, features, callback, classyWhens, classyThens);
|
|
35
|
+
};
|
|
36
|
+
return a;
|
|
37
|
+
}, {});
|
|
38
|
+
super(input, classySuites, classyGivens, classyWhens, classyThens, classyChecks, logWriter, testResourceRequirement, testSpecification);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ClassBuilder = ClassBuilder;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("./index.js");
|
|
4
|
+
const abstractBase_js_1 = require("./abstractBase.js");
|
|
5
|
+
const classBuilder_js_1 = require("./classBuilder.js");
|
|
6
|
+
class Testeranto extends classBuilder_js_1.ClassBuilder {
|
|
7
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement = index_js_1.defaultTestResourceRequirement, logWriter, testInterface) {
|
|
8
|
+
const fullTestInterface = (0, index_js_1.DefaultTestInterface)(testInterface);
|
|
9
|
+
super(testImplementation, testSpecification, input, class extends abstractBase_js_1.BaseSuite {
|
|
10
|
+
assertThat(t) {
|
|
11
|
+
fullTestInterface.assertThis(t);
|
|
12
|
+
}
|
|
13
|
+
async setup(s, artifactory, tr) {
|
|
14
|
+
return (fullTestInterface.beforeAll || (async (input, artifactory, tr) => input))(s, this.testResourceConfiguration, artifactory);
|
|
15
|
+
}
|
|
16
|
+
}, class Given extends abstractBase_js_1.BaseGiven {
|
|
17
|
+
async givenThat(subject, testResource, artifactory, initializer) {
|
|
18
|
+
return fullTestInterface.beforeEach(subject, initializer, (fPath, value) =>
|
|
19
|
+
// TODO does not work?
|
|
20
|
+
artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues);
|
|
21
|
+
}
|
|
22
|
+
afterEach(store, key, artifactory) {
|
|
23
|
+
return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value))));
|
|
24
|
+
}
|
|
25
|
+
afterAll(store, artifactory, utils) {
|
|
26
|
+
return fullTestInterface.afterAll(store, (fPath, value) => { artifactory(`afterAll4-${this.name}/${fPath}`, value); }, utils);
|
|
27
|
+
}
|
|
28
|
+
}, class When extends abstractBase_js_1.BaseWhen {
|
|
29
|
+
async andWhen(store, whenCB, testResource) {
|
|
30
|
+
return await fullTestInterface.andWhen(store, whenCB, testResource);
|
|
31
|
+
}
|
|
32
|
+
}, class Then extends abstractBase_js_1.BaseThen {
|
|
33
|
+
async butThen(store, thenCB, testResourceConfiguration) {
|
|
34
|
+
return await fullTestInterface.butThen(store, thenCB, testResourceConfiguration);
|
|
35
|
+
}
|
|
36
|
+
}, class Check extends abstractBase_js_1.BaseCheck {
|
|
37
|
+
constructor(name, features, checkCallback, whens, thens, initialValues) {
|
|
38
|
+
super(name, features, checkCallback, whens, thens);
|
|
39
|
+
this.initialValues = initialValues;
|
|
40
|
+
}
|
|
41
|
+
async checkThat(subject, testResourceConfiguration, artifactory) {
|
|
42
|
+
return fullTestInterface.beforeEach(subject, this.initialValues, (fPath, value) => artifactory(`before/${fPath}`, value), testResourceConfiguration, this.initialValues);
|
|
43
|
+
}
|
|
44
|
+
afterEach(store, key, artifactory) {
|
|
45
|
+
return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) =>
|
|
46
|
+
// TODO does not work?
|
|
47
|
+
artifactory(`afterEach2-${this.name}/${fPath}`, value))));
|
|
48
|
+
}
|
|
49
|
+
}, testResourceRequirement, logWriter);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.default = Testeranto;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultTestResourceRequirement = exports.DefaultTestInterface = exports.BaseTestInterface = void 0;
|
|
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),
|
|
12
|
+
};
|
|
13
|
+
const DefaultTestInterface = (p) => {
|
|
14
|
+
return Object.assign(Object.assign({}, exports.BaseTestInterface), p);
|
|
15
|
+
};
|
|
16
|
+
exports.DefaultTestInterface = DefaultTestInterface;
|
|
17
|
+
exports.defaultTestResourceRequirement = {
|
|
18
|
+
ports: 0
|
|
19
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NodeWriterElectron = void 0;
|
|
4
|
+
// import fs from "fs";
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
// import path from "path";
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const fPaths = [];
|
|
9
|
+
exports.NodeWriterElectron = {
|
|
10
|
+
createWriteStream: (filepath) => {
|
|
11
|
+
return fs.createWriteStream(filepath);
|
|
12
|
+
},
|
|
13
|
+
writeFileSync: (fp, contents) => {
|
|
14
|
+
fs.writeFileSync(fp, contents);
|
|
15
|
+
},
|
|
16
|
+
mkdirSync: async (fp) => {
|
|
17
|
+
await fs.mkdirSync(fp, { recursive: true });
|
|
18
|
+
},
|
|
19
|
+
testArtiFactoryfileWriter: (tLog, callback) => (fPath, value) => {
|
|
20
|
+
callback(new Promise((res, rej) => {
|
|
21
|
+
tLog("testArtiFactory =>", fPath);
|
|
22
|
+
const cleanPath = path.resolve(fPath);
|
|
23
|
+
fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
24
|
+
const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
25
|
+
fs.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
26
|
+
if (error) {
|
|
27
|
+
console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
28
|
+
}
|
|
29
|
+
fs.writeFileSync(path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
|
|
30
|
+
encoding: "utf-8",
|
|
31
|
+
});
|
|
32
|
+
if (Buffer.isBuffer(value)) {
|
|
33
|
+
fs.writeFileSync(fPath, value, "binary");
|
|
34
|
+
res();
|
|
35
|
+
}
|
|
36
|
+
else if (`string` === typeof value) {
|
|
37
|
+
fs.writeFileSync(fPath, value.toString(), {
|
|
38
|
+
encoding: "utf-8",
|
|
39
|
+
});
|
|
40
|
+
res();
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
/* @ts-ignore:next-line */
|
|
44
|
+
const pipeStream = value;
|
|
45
|
+
const myFile = fs.createWriteStream(fPath);
|
|
46
|
+
pipeStream.pipe(myFile);
|
|
47
|
+
pipeStream.on("close", () => {
|
|
48
|
+
myFile.close();
|
|
49
|
+
res();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
};
|
package/dist/common/preload.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const NodeWriter_1 = require("./NodeWriter");
|
|
4
3
|
const electron_1 = require("electron");
|
|
4
|
+
console.log("hello preloader");
|
|
5
|
+
const NodeWriter_1 = require("./NodeWriter");
|
|
5
6
|
window.NodeWriter = NodeWriter_1.NodeWriter;
|
|
6
7
|
window.exit = (x) => {
|
|
7
8
|
electron_1.ipcRenderer.invoke('quit-app', x);
|
|
8
9
|
};
|
|
9
|
-
var oldLog = console.log;
|
|
10
|
-
console.log = function (message) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
var oldLog = console.error;
|
|
15
|
-
console.error = function (message) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
var oldLog = console.warn;
|
|
20
|
-
console.warn = function (message) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
var oldLog = console.info;
|
|
25
|
-
console.info = function (message) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
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
|
+
// };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = () => `
|
|
4
|
+
<!DOCTYPE html>
|
|
5
|
+
<html lang="en">
|
|
6
|
+
|
|
7
|
+
<head>
|
|
8
|
+
<meta name="description" content="Webpage description goes here" />
|
|
9
|
+
<meta charset="utf-8" />
|
|
10
|
+
<title>kokomoBay - testeranto</title>
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
+
<meta name="author" content="" />
|
|
13
|
+
|
|
14
|
+
<link rel="stylesheet" href="./Report.css">
|
|
15
|
+
|
|
16
|
+
<script type="importmap">
|
|
17
|
+
{
|
|
18
|
+
"imports": {
|
|
19
|
+
"features.test.js": "./features.test.js",
|
|
20
|
+
"testeranto.json": "./testeranto.json"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script type="module" src="./Report.js"></script>
|
|
26
|
+
</head>
|
|
27
|
+
|
|
28
|
+
<body><div id="root">react is loading</div></body>
|
|
29
|
+
|
|
30
|
+
</html>
|
|
31
|
+
`;
|