testeranto 0.110.0 → 0.111.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/package.json +1 -1
- package/src/PM/main.ts +418 -92
- package/src/ReportClient.tsx +38 -30
- package/src/run.ts +4 -371
- package/tsc.log +8 -6
- package/dist/common/Init.js +0 -68
- package/dist/common/Node.js +0 -27
- package/dist/common/PM/index.js +0 -7
- package/dist/common/PM/main.js +0 -984
- package/dist/common/PM/node.js +0 -128
- package/dist/common/PM/web.js +0 -121
- package/dist/common/ReportServer.js +0 -22
- package/dist/common/SubPackages/react/component/node.js +0 -19
- package/dist/common/SubPackages/react/component/web.js +0 -19
- package/dist/common/SubPackages/react/jsx/index.js +0 -21
- package/dist/common/SubPackages/react/jsx/node.js +0 -10
- package/dist/common/SubPackages/react/jsx/web.js +0 -10
- package/dist/common/SubPackages/react-dom/component/node.js +0 -88
- package/dist/common/SubPackages/react-dom/component/web.js +0 -67
- package/dist/common/SubPackages/react-dom/jsx/index.js +0 -2
- package/dist/common/SubPackages/react-dom/jsx/node.js +0 -39
- package/dist/common/SubPackages/react-dom/jsx/web.js +0 -128
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -54
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -2
- package/dist/common/SubPackages/react-test-renderer/component/interface.js +0 -70
- 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/common/SubPackages/react-test-renderer/fc/node.js +0 -60
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +0 -60
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -67
- package/dist/common/SubPackages/react-test-renderer/jsx/node.js +0 -10
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +0 -10
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +0 -52
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
- package/dist/common/Types.js +0 -2
- package/dist/common/Web.js +0 -49
- package/dist/common/build.js +0 -222
- package/dist/common/defaultConfig.js +0 -20
- package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +0 -6
- package/dist/common/esbuildConfigs/featuresPlugin.js +0 -39
- package/dist/common/esbuildConfigs/index.js +0 -21
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +0 -27
- package/dist/common/esbuildConfigs/node.js +0 -37
- package/dist/common/esbuildConfigs/web.js +0 -50
- package/dist/common/init-docs.js +0 -53
- package/dist/common/lib/abstractBase.js +0 -329
- package/dist/common/lib/basebuilder.js +0 -98
- package/dist/common/lib/classBuilder.js +0 -40
- package/dist/common/lib/core.js +0 -117
- package/dist/common/lib/index.js +0 -21
- package/dist/common/lib/types.js +0 -2
- package/dist/common/package.json +0 -3
- package/dist/common/puppeteerConfiger.js +0 -24
- package/dist/common/run.js +0 -297
- package/dist/common/tsconfig.common.tsbuildinfo +0 -1
- package/dist/common/utils.js +0 -43
- package/dist/common/web.html.js +0 -22
- package/dist/module/Footer.js +0 -4
- package/dist/module/Init.js +0 -63
- package/dist/module/Node.js +0 -20
- package/dist/module/PM/index.js +0 -3
- package/dist/module/PM/main.js +0 -944
- package/dist/module/PM/node.js +0 -121
- package/dist/module/PM/web.js +0 -117
- package/dist/module/ReportClient.js +0 -97
- package/dist/module/ReportServer.js +0 -17
- package/dist/module/SubPackages/react/component/node.js +0 -14
- package/dist/module/SubPackages/react/component/web.js +0 -14
- package/dist/module/SubPackages/react/jsx/index.js +0 -15
- 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/component/node.js +0 -80
- package/dist/module/SubPackages/react-dom/component/web.js +0 -62
- package/dist/module/SubPackages/react-dom/jsx/index.js +0 -1
- package/dist/module/SubPackages/react-dom/jsx/node.js +0 -31
- package/dist/module/SubPackages/react-dom/jsx/web.js +0 -90
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
- package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/SubPackages/react-test-renderer/component/interface.js +0 -31
- package/dist/module/SubPackages/react-test-renderer/component/node.js +0 -3
- package/dist/module/SubPackages/react-test-renderer/component/web.js +0 -3
- package/dist/module/SubPackages/react-test-renderer/fc/node.js +0 -22
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +0 -22
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -28
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +0 -5
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +0 -5
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
- package/dist/module/TestReport.js +0 -91
- package/dist/module/Types.js +0 -1
- package/dist/module/Web.js +0 -42
- package/dist/module/build.js +0 -184
- package/dist/module/defaultConfig.js +0 -18
- package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +0 -3
- package/dist/module/esbuildConfigs/featuresPlugin.js +0 -34
- package/dist/module/esbuildConfigs/index.js +0 -19
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +0 -22
- package/dist/module/esbuildConfigs/node.js +0 -32
- package/dist/module/esbuildConfigs/web.js +0 -45
- package/dist/module/init-docs.js +0 -15
- package/dist/module/lib/abstractBase.js +0 -321
- package/dist/module/lib/basebuilder.js +0 -94
- package/dist/module/lib/classBuilder.js +0 -36
- package/dist/module/lib/core.js +0 -114
- package/dist/module/lib/index.js +0 -17
- package/dist/module/lib/types.js +0 -1
- package/dist/module/package.json +0 -3
- package/dist/module/puppeteerConfiger.js +0 -19
- package/dist/module/run.js +0 -259
- package/dist/module/tsconfig.module.tsbuildinfo +0 -1
- package/dist/module/utils.js +0 -29
- package/dist/module/web.html.js +0 -20
- package/dist/prebuild/ReportClient.css +0 -11367
- package/dist/prebuild/ReportClient.js +0 -23641
- package/dist/prebuild/ReportServer.mjs +0 -16
- package/dist/prebuild/TestReport.css +0 -11367
- package/dist/prebuild/TestReport.js +0 -27484
- package/dist/prebuild/build.mjs +0 -376
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +0 -9
- package/dist/prebuild/init-docs.mjs +0 -104
- package/dist/prebuild/run.mjs +0 -1190
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/Init.d.ts +0 -2
- package/dist/types/Node.d.ts +0 -12
- package/dist/types/PM/index.d.ts +0 -34
- package/dist/types/PM/main.d.ts +0 -59
- package/dist/types/PM/node.d.ts +0 -40
- package/dist/types/PM/web.d.ts +0 -38
- package/dist/types/ReportServer.d.ts +0 -1
- package/dist/types/SubPackages/react/component/node.d.ts +0 -7
- package/dist/types/SubPackages/react/component/web.d.ts +0 -7
- package/dist/types/SubPackages/react/jsx/index.d.ts +0 -12
- 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 -11
- package/dist/types/SubPackages/react-dom/component/web.d.ts +0 -20
- package/dist/types/SubPackages/react-dom/jsx/index.d.ts +0 -6
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +0 -7
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -6
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +0 -13
- package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +0 -4
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +0 -4
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +0 -16
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -15
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -5
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -5
- package/dist/types/Types.d.ts +0 -61
- package/dist/types/Web.d.ts +0 -9
- package/dist/types/build.d.ts +0 -1
- package/dist/types/defaultConfig.d.ts +0 -3
- package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +0 -2
- package/dist/types/esbuildConfigs/featuresPlugin.d.ts +0 -5
- package/dist/types/esbuildConfigs/index.d.ts +0 -4
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +0 -6
- package/dist/types/esbuildConfigs/node.d.ts +0 -4
- package/dist/types/esbuildConfigs/web.d.ts +0 -4
- package/dist/types/init-docs.d.ts +0 -1
- package/dist/types/lib/abstractBase.d.ts +0 -110
- package/dist/types/lib/basebuilder.d.ts +0 -27
- package/dist/types/lib/classBuilder.d.ts +0 -7
- package/dist/types/lib/core.d.ts +0 -7
- package/dist/types/lib/index.d.ts +0 -83
- package/dist/types/lib/types.d.ts +0 -14
- package/dist/types/puppeteerConfiger.d.ts +0 -4
- package/dist/types/run.d.ts +0 -1
- package/dist/types/tsconfig.types.tsbuildinfo +0 -1
- package/dist/types/utils.d.ts +0 -9
- package/dist/types/web.html.d.ts +0 -2
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default (config) => {
|
|
2
|
-
return {
|
|
3
|
-
// packages: "external",
|
|
4
|
-
target: "esnext",
|
|
5
|
-
format: "esm",
|
|
6
|
-
splitting: true,
|
|
7
|
-
outExtension: { ".js": ".mjs" },
|
|
8
|
-
outbase: config.outbase,
|
|
9
|
-
jsx: "transform",
|
|
10
|
-
bundle: true,
|
|
11
|
-
minify: config.minify === true,
|
|
12
|
-
write: true,
|
|
13
|
-
loader: {
|
|
14
|
-
".js": "jsx",
|
|
15
|
-
".png": "binary",
|
|
16
|
-
".jpg": "binary",
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
const otherInputs = {};
|
|
3
|
-
const register = (entrypoint, sources) => {
|
|
4
|
-
if (!otherInputs[entrypoint]) {
|
|
5
|
-
otherInputs[entrypoint] = new Set();
|
|
6
|
-
}
|
|
7
|
-
sources.forEach((s) => otherInputs[entrypoint].add(s));
|
|
8
|
-
};
|
|
9
|
-
export default (platform, entryPoints) => {
|
|
10
|
-
return {
|
|
11
|
-
register,
|
|
12
|
-
inputFilesPluginFactory: {
|
|
13
|
-
name: "metafileWriter",
|
|
14
|
-
setup(build) {
|
|
15
|
-
build.onEnd((result) => {
|
|
16
|
-
// console.log("build.onEnd", entryPoints);
|
|
17
|
-
fs.writeFileSync(`docs/${platform}/metafile.json`, JSON.stringify(result, null, 2));
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import baseEsBuildConfig from "./index.js";
|
|
2
|
-
import inputFilesPlugin from "./inputFilesPlugin.js";
|
|
3
|
-
import featuresPlugin from "./featuresPlugin";
|
|
4
|
-
export default (config, entryPoints) => {
|
|
5
|
-
const { inputFilesPluginFactory, register } = inputFilesPlugin("node", entryPoints);
|
|
6
|
-
return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { splitting: true, outdir: config.outdir + "/node",
|
|
7
|
-
// inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
|
|
8
|
-
metafile: true, supported: {
|
|
9
|
-
"dynamic-import": true,
|
|
10
|
-
}, define: {
|
|
11
|
-
"process.env.FLUENTFFMPEG_COV": "0",
|
|
12
|
-
}, absWorkingDir: process.cwd(), banner: {
|
|
13
|
-
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
|
|
14
|
-
}, platform: "node", external: ["react", ...config.externals], entryPoints: [...entryPoints], plugins: [
|
|
15
|
-
featuresPlugin,
|
|
16
|
-
inputFilesPluginFactory,
|
|
17
|
-
{
|
|
18
|
-
name: "rebuild-notify",
|
|
19
|
-
setup(build) {
|
|
20
|
-
build.onEnd((result) => {
|
|
21
|
-
console.log(`> node build ended with ${result.errors.length} errors`);
|
|
22
|
-
if (result.errors.length > 0) {
|
|
23
|
-
console.log(result);
|
|
24
|
-
}
|
|
25
|
-
// console.log(result);
|
|
26
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
|
|
31
|
-
] });
|
|
32
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import baseEsBuildConfig from "./index.js";
|
|
3
|
-
import inputFilesPlugin from "./inputFilesPlugin.js";
|
|
4
|
-
import featuresPlugin from "./featuresPlugin.js";
|
|
5
|
-
export default (config, entryPoints) => {
|
|
6
|
-
const { inputFilesPluginFactory, register } = inputFilesPlugin("web", entryPoints);
|
|
7
|
-
return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { outdir: config.outdir + "/web", alias: {
|
|
8
|
-
react: path.resolve("./node_modules/react"),
|
|
9
|
-
}, metafile: true, external: [
|
|
10
|
-
"path",
|
|
11
|
-
"fs",
|
|
12
|
-
"stream",
|
|
13
|
-
"http",
|
|
14
|
-
"constants",
|
|
15
|
-
"net",
|
|
16
|
-
"assert",
|
|
17
|
-
"tls",
|
|
18
|
-
"os",
|
|
19
|
-
"child_process",
|
|
20
|
-
"readline",
|
|
21
|
-
"zlib",
|
|
22
|
-
"crypto",
|
|
23
|
-
"https",
|
|
24
|
-
"util",
|
|
25
|
-
"process",
|
|
26
|
-
"dns",
|
|
27
|
-
], platform: "browser", entryPoints: [...entryPoints], plugins: [
|
|
28
|
-
featuresPlugin,
|
|
29
|
-
inputFilesPluginFactory,
|
|
30
|
-
{
|
|
31
|
-
name: "rebuild-notify",
|
|
32
|
-
setup(build) {
|
|
33
|
-
build.onEnd((result) => {
|
|
34
|
-
console.log(`> web build ended with ${result.errors.length} errors`);
|
|
35
|
-
if (result.errors.length > 0) {
|
|
36
|
-
console.log(result);
|
|
37
|
-
}
|
|
38
|
-
// console.log(result);
|
|
39
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
|
|
44
|
-
] });
|
|
45
|
-
};
|
package/dist/module/init-docs.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import Init from "./Init";
|
|
3
|
-
console.log("Initializing a testeranto project");
|
|
4
|
-
if (!process.argv[2]) {
|
|
5
|
-
console.log("You didn't pass a config file, so I will create one for you.");
|
|
6
|
-
fs.writeFileSync("testeranto.mts", fs.readFileSync("node_modules/testeranto/src/defaultConfig.ts"));
|
|
7
|
-
import(process.cwd() + "/" + "testeranto.mts").then((module) => {
|
|
8
|
-
Init(module.default);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
import(process.cwd() + "/" + process.argv[2]).then((module) => {
|
|
13
|
-
Init(module.default);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
export class BaseSuite {
|
|
2
|
-
constructor(name, index, givens = {}, checks = []) {
|
|
3
|
-
this.name = name;
|
|
4
|
-
this.index = index;
|
|
5
|
-
this.givens = givens;
|
|
6
|
-
this.checks = checks;
|
|
7
|
-
this.fails = [];
|
|
8
|
-
}
|
|
9
|
-
features() {
|
|
10
|
-
const features = Object.keys(this.givens)
|
|
11
|
-
.map((k) => this.givens[k].features)
|
|
12
|
-
.flat()
|
|
13
|
-
.filter((value, index, array) => {
|
|
14
|
-
return array.indexOf(value) === index;
|
|
15
|
-
});
|
|
16
|
-
// .reduce((mm, lm) => {
|
|
17
|
-
// mm[lm] = lm;
|
|
18
|
-
// return mm;
|
|
19
|
-
// }, {});
|
|
20
|
-
return features || [];
|
|
21
|
-
}
|
|
22
|
-
toObj() {
|
|
23
|
-
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
24
|
-
return {
|
|
25
|
-
name: this.name,
|
|
26
|
-
givens,
|
|
27
|
-
fails: this.fails,
|
|
28
|
-
features: this.features(),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
setup(s, artifactory, tr, pm) {
|
|
32
|
-
return new Promise((res) => res(s));
|
|
33
|
-
}
|
|
34
|
-
assertThat(t) {
|
|
35
|
-
return t;
|
|
36
|
-
}
|
|
37
|
-
afterAll(store, artifactory, pm) {
|
|
38
|
-
return store;
|
|
39
|
-
}
|
|
40
|
-
async run(input, testResourceConfiguration, artifactory, tLog, pm) {
|
|
41
|
-
this.testResourceConfiguration = testResourceConfiguration;
|
|
42
|
-
tLog("test resources: ", JSON.stringify(testResourceConfiguration));
|
|
43
|
-
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
44
|
-
// console.log("\nSuite:", this.index, this.name);
|
|
45
|
-
tLog("\nSuite:", this.index, this.name);
|
|
46
|
-
const sNdx = this.index;
|
|
47
|
-
const sName = this.name;
|
|
48
|
-
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
49
|
-
// console.log("gKey", gKey);
|
|
50
|
-
const beforeAllProxy = new Proxy(pm, {
|
|
51
|
-
get(target, prop, receiver) {
|
|
52
|
-
if (prop === "customScreenShot") {
|
|
53
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), {
|
|
54
|
-
// path: `${filepath}/${opts.path}`,
|
|
55
|
-
path: `suite-${sNdx}/beforeAll/${opts.path}` }), p);
|
|
56
|
-
}
|
|
57
|
-
if (prop === "writeFileSync") {
|
|
58
|
-
return (fp, contents) => target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
|
|
59
|
-
}
|
|
60
|
-
/* @ts-ignore:next-line */
|
|
61
|
-
return Reflect.get(...arguments);
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy);
|
|
65
|
-
const giver = this.givens[gKey];
|
|
66
|
-
try {
|
|
67
|
-
this.store = await giver.give(subject, gKey, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx);
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
console.error(e);
|
|
71
|
-
this.fails.push(giver);
|
|
72
|
-
// return this;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
this.afterAll(this.store, artifactory,
|
|
77
|
-
// afterAllProxy
|
|
78
|
-
pm);
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
console.error(e);
|
|
82
|
-
// this.fails.push(this);
|
|
83
|
-
// return this;
|
|
84
|
-
}
|
|
85
|
-
// for (const [ndx, thater] of this.checks.entries()) {
|
|
86
|
-
// await thater.check(
|
|
87
|
-
// subject,
|
|
88
|
-
// thater.name,
|
|
89
|
-
// testResourceConfiguration,
|
|
90
|
-
// this.assertThat,
|
|
91
|
-
// suiteArtifactory,
|
|
92
|
-
// tLog,
|
|
93
|
-
// pm
|
|
94
|
-
// );
|
|
95
|
-
// }
|
|
96
|
-
// @TODO fix me
|
|
97
|
-
// for (const k of Object.keys(this.givens)) {
|
|
98
|
-
// const giver = this.givens[k];
|
|
99
|
-
// try {
|
|
100
|
-
// giver.afterAll(this.store, artifactory, pm);
|
|
101
|
-
// } catch (e) {
|
|
102
|
-
// console.error(e);
|
|
103
|
-
// this.fails.push(giver);
|
|
104
|
-
// return this;
|
|
105
|
-
// }
|
|
106
|
-
// }
|
|
107
|
-
////////////////
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
export class BaseGiven {
|
|
112
|
-
constructor(name, features, whens, thens, givenCB, initialValues
|
|
113
|
-
// key: string
|
|
114
|
-
) {
|
|
115
|
-
this.name = name;
|
|
116
|
-
this.features = features;
|
|
117
|
-
this.whens = whens;
|
|
118
|
-
this.thens = thens;
|
|
119
|
-
this.givenCB = givenCB;
|
|
120
|
-
this.initialValues = initialValues;
|
|
121
|
-
}
|
|
122
|
-
beforeAll(store,
|
|
123
|
-
// artifactory: ITestArtifactory
|
|
124
|
-
// subject,
|
|
125
|
-
initializer, artifactory, testResource, initialValues, pm) {
|
|
126
|
-
return store;
|
|
127
|
-
}
|
|
128
|
-
toObj() {
|
|
129
|
-
return {
|
|
130
|
-
key: this.key,
|
|
131
|
-
name: this.name,
|
|
132
|
-
whens: this.whens.map((w) => w.toObj()),
|
|
133
|
-
thens: this.thens.map((t) => t.toObj()),
|
|
134
|
-
error: this.error ? [this.error, this.error.stack] : null,
|
|
135
|
-
// fail: this.fail ? [this.fail] : false,
|
|
136
|
-
features: this.features,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
async afterEach(store, key, artifactory, pm) {
|
|
140
|
-
return store;
|
|
141
|
-
}
|
|
142
|
-
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
|
|
143
|
-
this.key = key;
|
|
144
|
-
tLog(`\n ${this.key}`);
|
|
145
|
-
tLog(`\n Given: ${this.name}`);
|
|
146
|
-
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
147
|
-
try {
|
|
148
|
-
// tLog(`\n Given this.store`, this.store);
|
|
149
|
-
const beforeEachProxy = new Proxy(pm, {
|
|
150
|
-
get(target, prop, receiver) {
|
|
151
|
-
if (prop === "writeFileSync") {
|
|
152
|
-
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
|
|
153
|
-
}
|
|
154
|
-
if (prop === "customScreenShot") {
|
|
155
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
|
|
156
|
-
}
|
|
157
|
-
if (prop === "screencast") {
|
|
158
|
-
return (opts, p) => target.screencast(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
|
|
159
|
-
}
|
|
160
|
-
/* @ts-ignore:next-line */
|
|
161
|
-
return Reflect.get(...arguments);
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
this.uberCatcher((e) => {
|
|
165
|
-
console.error(e);
|
|
166
|
-
this.error = e.error;
|
|
167
|
-
tLog(e.stack);
|
|
168
|
-
});
|
|
169
|
-
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, beforeEachProxy);
|
|
170
|
-
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
171
|
-
await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
|
|
172
|
-
}
|
|
173
|
-
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
174
|
-
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
|
|
175
|
-
tester(t);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
catch (e) {
|
|
179
|
-
console.error(e);
|
|
180
|
-
this.error = e;
|
|
181
|
-
tLog(e.stack);
|
|
182
|
-
// tLog("\u0007"); // bell
|
|
183
|
-
// throw e;
|
|
184
|
-
}
|
|
185
|
-
finally {
|
|
186
|
-
try {
|
|
187
|
-
const afterEachProxy = new Proxy(pm, {
|
|
188
|
-
get(target, prop, receiver) {
|
|
189
|
-
if (prop === "customScreenShot") {
|
|
190
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/afterEach/${opts.path}` }), p);
|
|
191
|
-
}
|
|
192
|
-
if (prop === "writeFileSync") {
|
|
193
|
-
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterEach/${fp}`, contents);
|
|
194
|
-
}
|
|
195
|
-
/* @ts-ignore:next-line */
|
|
196
|
-
return Reflect.get(...arguments);
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
await this.afterEach(this.store, this.key, givenArtifactory,
|
|
200
|
-
// pm
|
|
201
|
-
afterEachProxy);
|
|
202
|
-
}
|
|
203
|
-
catch (e) {
|
|
204
|
-
console.error("afterEach failed! no error will be recorded!", e);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return this.store;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
export class BaseWhen {
|
|
211
|
-
constructor(name, whenCB) {
|
|
212
|
-
this.name = name;
|
|
213
|
-
this.whenCB = whenCB;
|
|
214
|
-
}
|
|
215
|
-
toObj() {
|
|
216
|
-
return {
|
|
217
|
-
name: this.name,
|
|
218
|
-
error: this.error,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
222
|
-
tLog(" When:", this.name);
|
|
223
|
-
const name = this.name;
|
|
224
|
-
const andWhenProxy = new Proxy(pm, {
|
|
225
|
-
get(target, prop, receiver) {
|
|
226
|
-
if (prop === "customScreenShot") {
|
|
227
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
|
|
228
|
-
}
|
|
229
|
-
if (prop === "writeFileSync") {
|
|
230
|
-
return (fp, contents) => target[prop](`${filepath}/andWhen/${fp}`, contents);
|
|
231
|
-
}
|
|
232
|
-
/* @ts-ignore:next-line */
|
|
233
|
-
return Reflect.get(...arguments);
|
|
234
|
-
},
|
|
235
|
-
});
|
|
236
|
-
return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy).catch((e) => {
|
|
237
|
-
this.error = true;
|
|
238
|
-
// throw e;
|
|
239
|
-
});
|
|
240
|
-
// try {
|
|
241
|
-
// return await this.andWhen(
|
|
242
|
-
// store,
|
|
243
|
-
// this.whenCB,
|
|
244
|
-
// testResourceConfiguration,
|
|
245
|
-
// andWhenProxy
|
|
246
|
-
// );
|
|
247
|
-
// } catch (e) {
|
|
248
|
-
// this.error = true;
|
|
249
|
-
// throw e;
|
|
250
|
-
// }
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
export class BaseThen {
|
|
254
|
-
constructor(name, thenCB) {
|
|
255
|
-
this.name = name;
|
|
256
|
-
this.thenCB = thenCB;
|
|
257
|
-
this.error = false;
|
|
258
|
-
}
|
|
259
|
-
toObj() {
|
|
260
|
-
return {
|
|
261
|
-
name: this.name,
|
|
262
|
-
error: this.error,
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
266
|
-
tLog(" Then:", this.name);
|
|
267
|
-
try {
|
|
268
|
-
const butThenProxy = new Proxy(pm, {
|
|
269
|
-
get(target, prop, receiver) {
|
|
270
|
-
if (prop === "customScreenShot") {
|
|
271
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
|
|
272
|
-
}
|
|
273
|
-
if (prop === "writeFileSync") {
|
|
274
|
-
return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
|
|
275
|
-
}
|
|
276
|
-
/* @ts-ignore:next-line */
|
|
277
|
-
return Reflect.get(...arguments);
|
|
278
|
-
},
|
|
279
|
-
});
|
|
280
|
-
return this.butThen(store, this.thenCB, testResourceConfiguration, butThenProxy).catch((e) => {
|
|
281
|
-
this.error = true;
|
|
282
|
-
throw e;
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
catch (e) {
|
|
286
|
-
console.log("test failed", e);
|
|
287
|
-
this.error = e.message;
|
|
288
|
-
throw e;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
export class BaseCheck {
|
|
293
|
-
constructor(name, features, checkCB, whens, thens) {
|
|
294
|
-
this.name = name;
|
|
295
|
-
this.features = features;
|
|
296
|
-
this.checkCB = checkCB;
|
|
297
|
-
this.whens = whens;
|
|
298
|
-
this.thens = thens;
|
|
299
|
-
}
|
|
300
|
-
async afterEach(store, key, cb, pm) {
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm) {
|
|
304
|
-
tLog(`\n Check: ${this.name}`);
|
|
305
|
-
const store = await this.checkThat(subject, testResourceConfiguration, artifactory, pm);
|
|
306
|
-
await this.checkCB(Object.entries(this.whens).reduce((a, [key, when]) => {
|
|
307
|
-
a[key] = async (payload) => {
|
|
308
|
-
return await when(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm, "x");
|
|
309
|
-
};
|
|
310
|
-
return a;
|
|
311
|
-
}, {}), Object.entries(this.thens).reduce((a, [key, then]) => {
|
|
312
|
-
a[key] = async (payload) => {
|
|
313
|
-
const t = await then(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm);
|
|
314
|
-
tester(t);
|
|
315
|
-
};
|
|
316
|
-
return a;
|
|
317
|
-
}, {}));
|
|
318
|
-
await this.afterEach(store, key, () => { }, pm);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
export class BaseBuilder {
|
|
2
|
-
constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, 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
|
-
this.testJobs = this.specs.map((suite) => {
|
|
15
|
-
const suiteRunner = (suite) => async (puppetMaster, tLog) => {
|
|
16
|
-
const x = await suite.run(input, puppetMaster.testResourceConfiguration, (fPath, value) => puppetMaster.testArtiFactoryfileWriter(tLog, (p) => {
|
|
17
|
-
this.artifacts.push(p);
|
|
18
|
-
})(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value), tLog, puppetMaster);
|
|
19
|
-
return x;
|
|
20
|
-
};
|
|
21
|
-
const runner = suiteRunner(suite);
|
|
22
|
-
return {
|
|
23
|
-
test: suite,
|
|
24
|
-
toObj: () => {
|
|
25
|
-
return suite.toObj();
|
|
26
|
-
},
|
|
27
|
-
runner,
|
|
28
|
-
receiveTestResourceConfig: async function (puppetMaster) {
|
|
29
|
-
const logFilePath = "log.txt";
|
|
30
|
-
const access = await puppetMaster.createWriteStream(logFilePath);
|
|
31
|
-
const tLog = (...l) => {
|
|
32
|
-
puppetMaster.write(access, `${l.toString()}\n`);
|
|
33
|
-
};
|
|
34
|
-
const suiteDone = await runner(puppetMaster, tLog);
|
|
35
|
-
const logPromise = new Promise((res, rej) => {
|
|
36
|
-
puppetMaster.end(access);
|
|
37
|
-
res(true);
|
|
38
|
-
});
|
|
39
|
-
const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
|
|
40
|
-
return suiteDone.givens[k].error;
|
|
41
|
-
}).length;
|
|
42
|
-
puppetMaster.writeFileSync(`bdd_errors.txt`, numberOfFailures.toString());
|
|
43
|
-
const o = this.toObj();
|
|
44
|
-
puppetMaster.writeFileSync(`littleBoard.html`, `
|
|
45
|
-
<!DOCTYPE html>
|
|
46
|
-
<html lang="en">
|
|
47
|
-
|
|
48
|
-
<head>
|
|
49
|
-
<meta name="description" content="Webpage description goes here" />
|
|
50
|
-
<meta charset="utf-8" />
|
|
51
|
-
<title>kokomoBay - testeranto</title>
|
|
52
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
53
|
-
<meta name="author" content="" />
|
|
54
|
-
|
|
55
|
-
<link rel="stylesheet" href="/kokomoBay/docs/TestReport.css" />
|
|
56
|
-
<script src="/kokomoBay/docs/TestReport.js"></script>
|
|
57
|
-
|
|
58
|
-
</head>
|
|
59
|
-
|
|
60
|
-
<body>
|
|
61
|
-
<h1>Test report</h1>
|
|
62
|
-
<div id="root"/>
|
|
63
|
-
</body>
|
|
64
|
-
`);
|
|
65
|
-
puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
|
|
66
|
-
return {
|
|
67
|
-
failed: numberOfFailures,
|
|
68
|
-
artifacts: this.artifacts || [],
|
|
69
|
-
logPromise,
|
|
70
|
-
features: suiteDone.features(),
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
Specs() {
|
|
77
|
-
return this.specs;
|
|
78
|
-
}
|
|
79
|
-
Suites() {
|
|
80
|
-
return this.suitesOverrides;
|
|
81
|
-
}
|
|
82
|
-
Given() {
|
|
83
|
-
return this.givenOverides;
|
|
84
|
-
}
|
|
85
|
-
When() {
|
|
86
|
-
return this.whenOverides;
|
|
87
|
-
}
|
|
88
|
-
Then() {
|
|
89
|
-
return this.thenOverides;
|
|
90
|
-
}
|
|
91
|
-
Check() {
|
|
92
|
-
return this.checkOverides;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { BaseBuilder } from "./basebuilder.js";
|
|
2
|
-
export class ClassBuilder extends BaseBuilder {
|
|
3
|
-
constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, checkKlasser, testResourceRequirement) {
|
|
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, g]) => {
|
|
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, testResourceRequirement, testSpecification);
|
|
35
|
-
}
|
|
36
|
-
}
|