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