testeranto 0.49.10 → 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.
- package/.nvmrc +1 -0
- package/README.md +92 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +37 -62
- package/dist/common/NodeWriter.js +7 -9
- package/dist/common/Project.js +130 -627
- 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 +19 -20
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +25 -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 -3
- 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 +3 -3
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +49 -113
- package/dist/common/electron.js +256 -42
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +37 -0
- package/dist/common/esbuildConfigs/report.js +13 -0
- package/dist/common/esbuildConfigs/tests.js +13 -0
- package/dist/common/esbuildConfigs/web.js +53 -0
- package/dist/common/lib/abstractBase.js +200 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/classBuilder.js +40 -0
- package/dist/common/lib/core.js +81 -0
- package/dist/common/lib/index.js +21 -0
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +15 -24
- package/dist/common/puppeteerConfiger.js +24 -0
- 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 +37 -62
- package/dist/module/NodeWriter.js +7 -9
- package/dist/module/Project.js +131 -605
- 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 +7 -7
- 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 +20 -21
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +22 -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 -3
- 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 +3 -3
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +2 -0
- package/dist/module/Web.js +49 -113
- package/dist/module/electron.js +257 -43
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +32 -0
- package/dist/module/esbuildConfigs/report.js +11 -0
- package/dist/module/esbuildConfigs/tests.js +11 -0
- package/dist/module/esbuildConfigs/web.js +48 -0
- package/dist/module/lib/abstractBase.js +192 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/classBuilder.js +36 -0
- package/dist/module/lib/core.js +78 -0
- package/dist/module/lib/index.js +17 -0
- package/dist/module/lib/types.js +1 -0
- package/dist/module/preload.js +12 -24
- package/dist/module/puppeteerConfiger.js +19 -0
- 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 +5 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -28
- 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/react-dom/component/node.d.ts +12 -0
- 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 → SubPackages}/react-test-renderer/component/node.d.ts +4 -4
- 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 +49 -17
- package/dist/types/Web.d.ts +5 -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 +4 -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 +103 -0
- package/dist/types/lib/basebuilder.d.ts +25 -0
- package/dist/types/lib/classBuilder.d.ts +7 -0
- package/dist/types/lib/core.d.ts +8 -0
- package/dist/types/lib/index.d.ts +58 -0
- package/dist/types/lib/types.d.ts +70 -0
- package/dist/types/puppeteerConfiger.d.ts +4 -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 +123 -87
- package/src/Features.ts +2 -4
- package/src/Node.ts +79 -155
- package/src/NodeWriter.ts +22 -22
- package/src/Project.ts +185 -783
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +51 -0
- package/src/SubPackages/react/component/node.ts +43 -0
- package/src/SubPackages/react/component/web.ts +43 -0
- package/src/SubPackages/react/jsx/index.ts +32 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +30 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +24 -44
- package/src/SubPackages/react-dom/component/web.ts +104 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/SubPackages/react-dom/jsx/web.ts +102 -0
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +38 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +37 -49
- package/src/SubPackages/react-test-renderer/component/node.ts +16 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +16 -0
- package/src/SubPackages/react-test-renderer/fc/node.ts +49 -0
- package/src/SubPackages/react-test-renderer/fc/web.ts +48 -0
- package/src/SubPackages/react-test-renderer/jsx/index.ts +49 -0
- package/src/SubPackages/react-test-renderer/jsx/node.ts +20 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +15 -26
- 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 +114 -17
- package/src/Web.ts +100 -225
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +303 -45
- package/src/esbuildConfigs/features.ts +17 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +60 -0
- package/src/esbuildConfigs/report.ts +15 -0
- package/src/esbuildConfigs/tests.ts +14 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +412 -0
- package/src/lib/basebuilder.ts +228 -0
- package/src/lib/classBuilder.ts +118 -0
- package/src/lib/core.ts +214 -0
- package/src/lib/index.ts +117 -0
- package/src/lib/types.ts +206 -0
- package/src/preload.ts +13 -27
- package/src/puppeteerConfiger.ts +26 -0
- 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/node.d.ts +0 -14
- 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/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/node.ts +0 -75
- 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/component/web.ts +0 -129
- package/src/subPackages/react-dom/jsx/node.ts +0 -145
- package/src/subPackages/react-dom/jsx/web.ts +0 -145
- package/src/subPackages/react-test-renderer/MemoExoticComponent/node.ts +0 -67
- 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/fc/node.ts +0 -77
- package/src/subPackages/react-test-renderer/fc/web.ts +0 -77
- package/src/subPackages/react-test-renderer/jsx/index.ts +0 -51
- 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,82 @@
|
|
|
1
|
+
export class BaseBuilder {
|
|
2
|
+
constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, logWriter, testResourceRequirement, testSpecification) {
|
|
3
|
+
this.input = input;
|
|
4
|
+
this.artifacts = [];
|
|
5
|
+
this.artifacts = [];
|
|
6
|
+
this.testResourceRequirement = testResourceRequirement;
|
|
7
|
+
this.suitesOverrides = suitesOverrides;
|
|
8
|
+
this.givenOverides = givenOverides;
|
|
9
|
+
this.whenOverides = whenOverides;
|
|
10
|
+
this.thenOverides = thenOverides;
|
|
11
|
+
this.checkOverides = checkOverides;
|
|
12
|
+
this.testSpecification = testSpecification;
|
|
13
|
+
this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
|
|
14
|
+
const suiteRunner = (suite, utils) => async (testResourceConfiguration, tLog, utils) => {
|
|
15
|
+
return await suite.run(input, testResourceConfiguration, (fPath, value) => logWriter.testArtiFactoryfileWriter(tLog, (p) => {
|
|
16
|
+
this.artifacts.push(p);
|
|
17
|
+
})(testResourceConfiguration.fs + "/" + fPath, value), tLog, utils);
|
|
18
|
+
};
|
|
19
|
+
this.testJobs = this.specs.map((suite, utils) => {
|
|
20
|
+
const runner = suiteRunner(suite, utils);
|
|
21
|
+
return {
|
|
22
|
+
test: suite,
|
|
23
|
+
testResourceRequirement,
|
|
24
|
+
toObj: () => {
|
|
25
|
+
return suite.toObj();
|
|
26
|
+
},
|
|
27
|
+
runner,
|
|
28
|
+
receiveTestResourceConfig: async function (testResourceConfiguration = {
|
|
29
|
+
name: "",
|
|
30
|
+
fs: ".",
|
|
31
|
+
ports: [],
|
|
32
|
+
scheduled: false,
|
|
33
|
+
}, y) {
|
|
34
|
+
console.log(`testResourceConfiguration ${JSON.stringify(testResourceConfiguration, null, 2)}`);
|
|
35
|
+
// await logWriter.mkdirSync(testResourceConfiguration.fs);
|
|
36
|
+
// if (!fs.existsSync(destFolder)) {
|
|
37
|
+
// fs.mkdirSync(destFolder, { recursive: true });
|
|
38
|
+
// }
|
|
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) => access.write(`${l.toString()}\n`);
|
|
43
|
+
const suiteDone = await runner(testResourceConfiguration, tLog, y);
|
|
44
|
+
const logPromise = new Promise((res, rej) => {
|
|
45
|
+
access.on("finish", () => {
|
|
46
|
+
res(true);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
access.end();
|
|
50
|
+
const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
|
|
51
|
+
return suiteDone.givens[k].error;
|
|
52
|
+
}).length;
|
|
53
|
+
logWriter.writeFileSync(`${testResourceConfiguration.fs}/exitcode`, numberOfFailures.toString());
|
|
54
|
+
console.log(`exiting gracefully with ${numberOfFailures} failures.`);
|
|
55
|
+
return {
|
|
56
|
+
failed: numberOfFailures,
|
|
57
|
+
artifacts: this.artifacts || [],
|
|
58
|
+
logPromise,
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
Specs() {
|
|
65
|
+
return this.specs;
|
|
66
|
+
}
|
|
67
|
+
Suites() {
|
|
68
|
+
return this.suitesOverrides;
|
|
69
|
+
}
|
|
70
|
+
Given() {
|
|
71
|
+
return this.givenOverides;
|
|
72
|
+
}
|
|
73
|
+
When() {
|
|
74
|
+
return this.whenOverides;
|
|
75
|
+
}
|
|
76
|
+
Then() {
|
|
77
|
+
return this.thenOverides;
|
|
78
|
+
}
|
|
79
|
+
Check() {
|
|
80
|
+
return this.checkOverides;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseBuilder } from "./basebuilder.js";
|
|
2
|
+
export class ClassBuilder extends BaseBuilder {
|
|
3
|
+
constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement, logWriter) {
|
|
4
|
+
const classySuites = Object.entries(testImplementation.suites).reduce((a, [key], index) => {
|
|
5
|
+
a[key] = (somestring, givens, checks) => {
|
|
6
|
+
return new suiteKlasser.prototype.constructor(somestring, index, givens, checks);
|
|
7
|
+
};
|
|
8
|
+
return a;
|
|
9
|
+
}, {});
|
|
10
|
+
const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, givEn]) => {
|
|
11
|
+
a[key] = (features, whens, thens, givEn) => {
|
|
12
|
+
return new givenKlasser.prototype.constructor(key, features, whens, thens, testImplementation.givens[key], givEn);
|
|
13
|
+
};
|
|
14
|
+
return a;
|
|
15
|
+
}, {});
|
|
16
|
+
const classyWhens = Object.entries(testImplementation.whens).reduce((a, [key, whEn]) => {
|
|
17
|
+
a[key] = (payload) => {
|
|
18
|
+
return new whenKlasser.prototype.constructor(`${whEn.name}: ${payload && payload.toString()}`, whEn(payload));
|
|
19
|
+
};
|
|
20
|
+
return a;
|
|
21
|
+
}, {});
|
|
22
|
+
const classyThens = Object.entries(testImplementation.thens).reduce((a, [key, thEn]) => {
|
|
23
|
+
a[key] = (expected, x) => {
|
|
24
|
+
return new thenKlasser.prototype.constructor(`${thEn.name}: ${expected && expected.toString()}`, thEn(expected));
|
|
25
|
+
};
|
|
26
|
+
return a;
|
|
27
|
+
}, {});
|
|
28
|
+
const classyChecks = Object.entries(testImplementation.checks).reduce((a, [key, z]) => {
|
|
29
|
+
a[key] = (somestring, features, callback) => {
|
|
30
|
+
return new checkKlasser.prototype.constructor(somestring, features, callback, classyWhens, classyThens);
|
|
31
|
+
};
|
|
32
|
+
return a;
|
|
33
|
+
}, {});
|
|
34
|
+
super(input, classySuites, classyGivens, classyWhens, classyThens, classyChecks, logWriter, testResourceRequirement, testSpecification);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { DefaultTestInterface, defaultTestResourceRequirement, } from "./index.js";
|
|
2
|
+
import { BaseSuite, BaseGiven, BaseWhen, BaseThen, BaseCheck, } from "./abstractBase.js";
|
|
3
|
+
import { ClassBuilder } from "./classBuilder.js";
|
|
4
|
+
export default class Testeranto extends ClassBuilder {
|
|
5
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, logWriter, testInterface) {
|
|
6
|
+
const fullTestInterface = DefaultTestInterface(testInterface);
|
|
7
|
+
super(testImplementation, testSpecification, input, class extends BaseSuite {
|
|
8
|
+
assertThat(t) {
|
|
9
|
+
fullTestInterface.assertThis(t);
|
|
10
|
+
}
|
|
11
|
+
async setup(s, artifactory, tr, utils) {
|
|
12
|
+
return (fullTestInterface.beforeAll ||
|
|
13
|
+
(async (input, artifactory, tr, utils) => input))(s, this.testResourceConfiguration, artifactory, utils);
|
|
14
|
+
}
|
|
15
|
+
}, class Given extends BaseGiven {
|
|
16
|
+
async givenThat(subject, testResource, artifactory, initializer) {
|
|
17
|
+
return fullTestInterface.beforeEach(subject, initializer, (fPath, value) =>
|
|
18
|
+
// TODO does not work?
|
|
19
|
+
artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues
|
|
20
|
+
// utils,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
afterEach(store, key, artifactory, utils) {
|
|
24
|
+
return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value), utils)));
|
|
25
|
+
}
|
|
26
|
+
afterAll(store, artifactory, utils) {
|
|
27
|
+
const pagesHandler = {
|
|
28
|
+
get(target, prop) {
|
|
29
|
+
console.log(`Getting pages property ${prop}`);
|
|
30
|
+
return target[prop];
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const browserHandler = {
|
|
34
|
+
get(target, prop) {
|
|
35
|
+
console.log(`Getting browser property ${prop}`);
|
|
36
|
+
if (prop === "pages") {
|
|
37
|
+
// return target[prop];
|
|
38
|
+
return new Proxy(target[prop], pagesHandler);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return target[prop];
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
const proxy = new Proxy(utils.browser, browserHandler);
|
|
46
|
+
return fullTestInterface.afterAll(store, (fPath, value) => {
|
|
47
|
+
artifactory(`afterAll4-${this.name}/${fPath}`, value);
|
|
48
|
+
}, utils
|
|
49
|
+
// {
|
|
50
|
+
// ...utils,
|
|
51
|
+
// browser: proxy,
|
|
52
|
+
// }
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}, class When extends BaseWhen {
|
|
56
|
+
async andWhen(store, whenCB, testResource) {
|
|
57
|
+
return await fullTestInterface.andWhen(store, whenCB, testResource);
|
|
58
|
+
}
|
|
59
|
+
}, class Then extends BaseThen {
|
|
60
|
+
async butThen(store, thenCB, testResourceConfiguration) {
|
|
61
|
+
return await fullTestInterface.butThen(store, thenCB, testResourceConfiguration);
|
|
62
|
+
}
|
|
63
|
+
}, class Check extends BaseCheck {
|
|
64
|
+
constructor(name, features, checkCallback, whens, thens, initialValues) {
|
|
65
|
+
super(name, features, checkCallback, whens, thens);
|
|
66
|
+
this.initialValues = initialValues;
|
|
67
|
+
}
|
|
68
|
+
async checkThat(subject, testResourceConfiguration, artifactory) {
|
|
69
|
+
return fullTestInterface.beforeEach(subject, this.initialValues, (fPath, value) => artifactory(`before/${fPath}`, value), testResourceConfiguration, this.initialValues);
|
|
70
|
+
}
|
|
71
|
+
afterEach(store, key, artifactory, utils) {
|
|
72
|
+
return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) =>
|
|
73
|
+
// TODO does not work?
|
|
74
|
+
artifactory(`afterEach2-${this.name}/${fPath}`, value), utils)));
|
|
75
|
+
}
|
|
76
|
+
}, testResourceRequirement, logWriter);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const BaseTestInterface = {
|
|
2
|
+
beforeAll: async (s) => s,
|
|
3
|
+
beforeEach: async function (subject, initialValues, testResource) {
|
|
4
|
+
return subject;
|
|
5
|
+
},
|
|
6
|
+
afterEach: async (s) => s,
|
|
7
|
+
afterAll: (store) => undefined,
|
|
8
|
+
butThen: async (store, thenCb) => thenCb(store),
|
|
9
|
+
andWhen: (a) => a,
|
|
10
|
+
assertThis: () => null,
|
|
11
|
+
};
|
|
12
|
+
export const DefaultTestInterface = (p) => {
|
|
13
|
+
return Object.assign(Object.assign({}, BaseTestInterface), p);
|
|
14
|
+
};
|
|
15
|
+
export const defaultTestResourceRequirement = {
|
|
16
|
+
ports: 0,
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/module/preload.js
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
|
+
import puppeteer from "puppeteer-core";
|
|
1
2
|
import { NodeWriter } from "./NodeWriter";
|
|
2
|
-
import
|
|
3
|
+
import puppeteerConfiger from "./puppeteerConfiger";
|
|
3
4
|
window.NodeWriter = NodeWriter;
|
|
4
|
-
window.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ipcRenderer.invoke('web-error', message.toString());
|
|
15
|
-
oldLog.apply(console, arguments);
|
|
16
|
-
};
|
|
17
|
-
var oldLog = console.warn;
|
|
18
|
-
console.warn = function (message) {
|
|
19
|
-
ipcRenderer.invoke('web-warn', message.toString());
|
|
20
|
-
oldLog.apply(console, arguments);
|
|
21
|
-
};
|
|
22
|
-
var oldLog = console.info;
|
|
23
|
-
console.info = function (message) {
|
|
24
|
-
ipcRenderer.invoke('web-info', message.toString());
|
|
25
|
-
oldLog.apply(console, arguments);
|
|
26
|
-
};
|
|
5
|
+
window.browser = new Promise(async (res, rej) => {
|
|
6
|
+
const browser = await puppeteerConfiger("2999").then(async (json) => {
|
|
7
|
+
const b = await puppeteer.connect({
|
|
8
|
+
browserWSEndpoint: json.webSocketDebuggerUrl,
|
|
9
|
+
defaultViewport: null,
|
|
10
|
+
});
|
|
11
|
+
console.log("connected!", b.isConnected());
|
|
12
|
+
return res(b);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import http from "http";
|
|
2
|
+
export default async (port) => new Promise((resolve, reject) => {
|
|
3
|
+
let json = "";
|
|
4
|
+
const request = http.request({
|
|
5
|
+
host: "127.0.0.1",
|
|
6
|
+
path: "/json/version",
|
|
7
|
+
port,
|
|
8
|
+
}, (response) => {
|
|
9
|
+
response.on("error", reject);
|
|
10
|
+
response.on("data", (chunk) => {
|
|
11
|
+
json += chunk.toString();
|
|
12
|
+
});
|
|
13
|
+
response.on("end", () => {
|
|
14
|
+
resolve(JSON.parse(json));
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
request.on("error", reject);
|
|
18
|
+
request.end();
|
|
19
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default () => `
|
|
2
|
+
<!DOCTYPE html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
<meta name="description" content="Webpage description goes here" />
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<title>kokomoBay - testeranto</title>
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10
|
+
<meta name="author" content="" />
|
|
11
|
+
|
|
12
|
+
<link rel="stylesheet" href="./Report.css">
|
|
13
|
+
|
|
14
|
+
<script type="importmap">
|
|
15
|
+
{
|
|
16
|
+
"imports": {
|
|
17
|
+
"features.test.js": "./features.test.js",
|
|
18
|
+
"testeranto.json": "./testeranto.json"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script type="module" src="./Report.js"></script>
|
|
24
|
+
</head>
|
|
25
|
+
|
|
26
|
+
<body><div id="root">react is loading</div></body>
|
|
27
|
+
|
|
28
|
+
</html>
|
|
29
|
+
`;
|