testeranto 0.100.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/README.md +1 -0
- package/bundle.js +80 -30
- package/package.json +40 -32
- package/src/Footer.tsx +4 -0
- package/src/Init.ts +48 -0
- package/src/Node.ts +23 -17
- package/src/PM/index.ts +1 -1
- package/src/PM/main.ts +524 -156
- package/src/PM/node.ts +2 -2
- package/src/PM/web.ts +1 -1
- package/src/ReportClient.tsx +163 -0
- package/src/ReportServer.ts +21 -0
- package/src/SubPackages/react/component/node.ts +68 -24
- package/src/SubPackages/react/component/web.ts +68 -25
- package/src/SubPackages/react/jsx/index.ts +39 -18
- package/src/SubPackages/react/jsx/node.ts +12 -10
- package/src/SubPackages/react/jsx/web.ts +27 -14
- package/src/SubPackages/react-dom/component/node.ts +42 -50
- package/src/SubPackages/react-dom/component/web.ts +28 -10
- package/src/SubPackages/react-dom/jsx/node.ts +54 -56
- package/src/SubPackages/react-dom/jsx/web.ts +55 -42
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +23 -7
- package/src/SubPackages/react-test-renderer/component/index.ts +38 -5
- package/src/SubPackages/react-test-renderer/component/node.ts +24 -5
- package/src/SubPackages/react-test-renderer/component/web.ts +22 -5
- package/src/SubPackages/react-test-renderer/fc/node.ts +41 -7
- package/src/SubPackages/react-test-renderer/fc/web.ts +43 -11
- package/src/SubPackages/react-test-renderer/jsx/index.ts +39 -16
- package/src/SubPackages/react-test-renderer/jsx/node.ts +8 -6
- package/src/SubPackages/react-test-renderer/jsx/web.ts +22 -5
- package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +39 -6
- package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +27 -10
- package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +26 -12
- package/src/TestReport.tsx +176 -0
- package/src/Types.ts +63 -309
- package/src/Web.ts +24 -18
- package/src/build.ts +240 -0
- package/src/defaultConfig.ts +2 -1
- package/src/esbuildConfigs/eslint-formatter-testeranto.ts +5 -0
- package/src/esbuildConfigs/featuresPlugin.ts +0 -1
- package/src/esbuildConfigs/index.ts +1 -1
- package/src/esbuildConfigs/inputFilesPlugin.ts +2 -135
- package/src/esbuildConfigs/node.ts +4 -13
- package/src/esbuildConfigs/web.ts +3 -19
- package/src/init-docs.ts +2 -1
- package/src/lib/abstractBase.ts +82 -80
- package/src/lib/basebuilder.ts +57 -45
- package/src/lib/classBuilder.ts +15 -15
- package/src/lib/core.ts +44 -35
- package/src/lib/index.ts +47 -98
- package/src/lib/readme.md +12 -0
- package/src/lib/types.ts +53 -70
- package/src/run.ts +31 -0
- package/src/style.css +8 -0
- package/src/utils.ts +74 -2
- package/tsc.log +108 -0
- package/Bundle.Dockerfile +0 -52
- package/bin/init-docs.js +0 -24
- package/dist/common/dist/module/src/Init.js +0 -40
- package/dist/common/package.json +0 -3
- package/dist/common/src/Init.js +0 -40
- package/dist/common/src/Node.js +0 -27
- package/dist/common/src/PM/index.js +0 -7
- package/dist/common/src/PM/main.js +0 -941
- package/dist/common/src/PM/node.js +0 -128
- package/dist/common/src/PM/web.js +0 -121
- package/dist/common/src/SubPackages/puppeteer.js +0 -21
- package/dist/common/src/SubPackages/react/component/node.js +0 -19
- package/dist/common/src/SubPackages/react/component/web.js +0 -19
- package/dist/common/src/SubPackages/react/jsx/index.js +0 -33
- package/dist/common/src/SubPackages/react/jsx/node.js +0 -10
- package/dist/common/src/SubPackages/react/jsx/web.js +0 -10
- package/dist/common/src/SubPackages/react-dom/component/node.js +0 -101
- package/dist/common/src/SubPackages/react-dom/component/web.js +0 -67
- package/dist/common/src/SubPackages/react-dom/jsx/index.js +0 -2
- package/dist/common/src/SubPackages/react-dom/jsx/node.js +0 -39
- package/dist/common/src/SubPackages/react-dom/jsx/web.js +0 -117
- package/dist/common/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -44
- package/dist/common/src/SubPackages/react-test-renderer/component/index.js +0 -2
- package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +0 -60
- package/dist/common/src/SubPackages/react-test-renderer/component/node.js +0 -8
- package/dist/common/src/SubPackages/react-test-renderer/component/web.js +0 -8
- package/dist/common/src/SubPackages/react-test-renderer/fc/node.js +0 -50
- package/dist/common/src/SubPackages/react-test-renderer/fc/web.js +0 -50
- package/dist/common/src/SubPackages/react-test-renderer/jsx/index.js +0 -63
- package/dist/common/src/SubPackages/react-test-renderer/jsx/node.js +0 -10
- package/dist/common/src/SubPackages/react-test-renderer/jsx/web.js +0 -10
- package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -42
- package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
- package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
- package/dist/common/src/Types.js +0 -2
- package/dist/common/src/Web.js +0 -49
- package/dist/common/src/cli.js +0 -439
- package/dist/common/src/cli2.js +0 -144
- package/dist/common/src/defaultConfig.js +0 -19
- package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
- package/dist/common/src/esbuildConfigs/index.js +0 -21
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -99
- package/dist/common/src/esbuildConfigs/node.js +0 -45
- package/dist/common/src/esbuildConfigs/web.js +0 -61
- package/dist/common/src/init-docs.js +0 -43
- package/dist/common/src/lib/abstractBase.js +0 -324
- package/dist/common/src/lib/basebuilder.js +0 -85
- package/dist/common/src/lib/classBuilder.js +0 -42
- package/dist/common/src/lib/core.js +0 -101
- package/dist/common/src/lib/index.js +0 -22
- package/dist/common/src/lib/types.js +0 -3
- package/dist/common/src/puppeteerConfiger.js +0 -24
- package/dist/common/src/utils.js +0 -16
- package/dist/common/src/web.html.js +0 -22
- package/dist/common/testeranto.js +0 -15
- package/dist/common/tsconfig.common.tsbuildinfo +0 -1
- package/dist/module/package.json +0 -3
- package/dist/module/src/Init.js +0 -35
- package/dist/module/src/Node.js +0 -20
- package/dist/module/src/PM/index.js +0 -3
- package/dist/module/src/PM/main.js +0 -911
- package/dist/module/src/PM/node.js +0 -121
- package/dist/module/src/PM/web.js +0 -117
- package/dist/module/src/SubPackages/puppeteer.js +0 -16
- package/dist/module/src/SubPackages/react/component/node.js +0 -14
- package/dist/module/src/SubPackages/react/component/web.js +0 -14
- package/dist/module/src/SubPackages/react/jsx/index.js +0 -27
- package/dist/module/src/SubPackages/react/jsx/node.js +0 -5
- package/dist/module/src/SubPackages/react/jsx/web.js +0 -5
- package/dist/module/src/SubPackages/react-dom/component/node.js +0 -93
- package/dist/module/src/SubPackages/react-dom/component/web.js +0 -62
- package/dist/module/src/SubPackages/react-dom/jsx/index.js +0 -1
- package/dist/module/src/SubPackages/react-dom/jsx/node.js +0 -31
- package/dist/module/src/SubPackages/react-dom/jsx/web.js +0 -89
- package/dist/module/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
- package/dist/module/src/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +0 -31
- package/dist/module/src/SubPackages/react-test-renderer/component/node.js +0 -3
- package/dist/module/src/SubPackages/react-test-renderer/component/web.js +0 -3
- package/dist/module/src/SubPackages/react-test-renderer/fc/node.js +0 -22
- package/dist/module/src/SubPackages/react-test-renderer/fc/web.js +0 -22
- package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +0 -34
- package/dist/module/src/SubPackages/react-test-renderer/jsx/node.js +0 -5
- package/dist/module/src/SubPackages/react-test-renderer/jsx/web.js +0 -5
- package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
- package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
- package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
- package/dist/module/src/Types.js +0 -1
- package/dist/module/src/Web.js +0 -42
- package/dist/module/src/cli.js +0 -411
- package/dist/module/src/cli2.js +0 -116
- package/dist/module/src/defaultConfig.js +0 -17
- package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
- package/dist/module/src/esbuildConfigs/index.js +0 -19
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -94
- package/dist/module/src/esbuildConfigs/node.js +0 -40
- package/dist/module/src/esbuildConfigs/web.js +0 -56
- package/dist/module/src/init-docs.js +0 -15
- package/dist/module/src/lib/abstractBase.js +0 -316
- package/dist/module/src/lib/basebuilder.js +0 -81
- package/dist/module/src/lib/classBuilder.js +0 -38
- package/dist/module/src/lib/core.js +0 -98
- package/dist/module/src/lib/index.js +0 -18
- package/dist/module/src/lib/types.js +0 -2
- package/dist/module/src/puppeteerConfiger.js +0 -19
- package/dist/module/src/utils.js +0 -9
- package/dist/module/src/web.html.js +0 -20
- package/dist/module/testeranto.js +0 -13
- package/dist/module/tsconfig.module.tsbuildinfo +0 -1
- package/dist/prebuild/cli.mjs +0 -1491
- package/dist/prebuild/cli2.mjs +0 -918
- package/dist/prebuild/init-docs.mjs +0 -48
- package/dist/types/dist/module/src/Init.d.ts +0 -2
- package/dist/types/src/Init.d.ts +0 -2
- package/dist/types/src/Node.d.ts +0 -13
- package/dist/types/src/PM/index.d.ts +0 -34
- package/dist/types/src/PM/main.d.ts +0 -56
- package/dist/types/src/PM/node.d.ts +0 -42
- package/dist/types/src/PM/web.d.ts +0 -40
- package/dist/types/src/SubPackages/puppeteer.d.ts +0 -6
- package/dist/types/src/SubPackages/react/component/node.d.ts +0 -7
- package/dist/types/src/SubPackages/react/component/web.d.ts +0 -7
- package/dist/types/src/SubPackages/react/jsx/index.d.ts +0 -12
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/src/SubPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/src/SubPackages/react-dom/component/node.d.ts +0 -12
- package/dist/types/src/SubPackages/react-dom/component/web.d.ts +0 -11
- package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +0 -7
- package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +0 -6
- package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
- package/dist/types/src/SubPackages/react-test-renderer/component/index.d.ts +0 -13
- package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
- package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +0 -8
- package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +0 -3
- package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
- package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +0 -8
- package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +0 -17
- package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
- package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +0 -8
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -16
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
- package/dist/types/src/Types.d.ts +0 -90
- package/dist/types/src/Web.d.ts +0 -10
- package/dist/types/src/cli.d.ts +0 -1
- package/dist/types/src/cli2.d.ts +0 -1
- package/dist/types/src/defaultConfig.d.ts +0 -3
- package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
- package/dist/types/src/esbuildConfigs/index.d.ts +0 -4
- package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
- package/dist/types/src/esbuildConfigs/node.d.ts +0 -4
- package/dist/types/src/esbuildConfigs/web.d.ts +0 -4
- package/dist/types/src/init-docs.d.ts +0 -1
- package/dist/types/src/lib/abstractBase.d.ts +0 -110
- package/dist/types/src/lib/basebuilder.d.ts +0 -27
- package/dist/types/src/lib/classBuilder.d.ts +0 -7
- package/dist/types/src/lib/core.d.ts +0 -8
- package/dist/types/src/lib/index.d.ts +0 -60
- package/dist/types/src/lib/types.d.ts +0 -40
- package/dist/types/src/puppeteerConfiger.d.ts +0 -4
- package/dist/types/src/utils.d.ts +0 -2
- package/dist/types/src/web.html.d.ts +0 -2
- package/dist/types/testeranto.d.ts +0 -16
- package/dist/types/tsconfig.types.tsbuildinfo +0 -1
- package/docker-compose.yml +0 -37
- package/src/SubPackages/puppeteer.ts +0 -51
- package/src/cli.ts +0 -535
- package/src/cli2.ts +0 -157
- package/testeranto.ts +0 -13
|
@@ -1,99 +0,0 @@
|
|
|
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 fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
const otherInputs = {};
|
|
10
|
-
const register = (entrypoint, sources) => {
|
|
11
|
-
if (!otherInputs[entrypoint]) {
|
|
12
|
-
otherInputs[entrypoint] = new Set();
|
|
13
|
-
}
|
|
14
|
-
sources.forEach((s) => otherInputs[entrypoint].add(s));
|
|
15
|
-
};
|
|
16
|
-
function tree(meta, key) {
|
|
17
|
-
const outputKey = Object.keys(meta.outputs).find((k) => {
|
|
18
|
-
return meta.outputs[k].entryPoint === key;
|
|
19
|
-
});
|
|
20
|
-
if (!outputKey) {
|
|
21
|
-
console.error("No outputkey found");
|
|
22
|
-
process.exit(-1);
|
|
23
|
-
}
|
|
24
|
-
return Object.keys(meta.outputs[outputKey].inputs).filter((k) => k.startsWith("src"));
|
|
25
|
-
}
|
|
26
|
-
exports.default = (platform, entryPoints) => {
|
|
27
|
-
return {
|
|
28
|
-
register,
|
|
29
|
-
inputFilesPluginFactory: {
|
|
30
|
-
name: "metafileWriter",
|
|
31
|
-
setup(build) {
|
|
32
|
-
build.onEnd((result) => {
|
|
33
|
-
fs_1.default.writeFileSync(`docs/${platform}/metafile.json`, JSON.stringify(result, null, 2));
|
|
34
|
-
if (result.errors.length === 0) {
|
|
35
|
-
entryPoints.forEach((entryPoint) => {
|
|
36
|
-
const filePath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
|
|
37
|
-
const dirName = path_1.default.dirname(filePath);
|
|
38
|
-
if (!fs_1.default.existsSync(dirName)) {
|
|
39
|
-
fs_1.default.mkdirSync(dirName, { recursive: true });
|
|
40
|
-
}
|
|
41
|
-
const promptPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
|
|
42
|
-
const testPaths = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
|
|
43
|
-
const featuresPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
|
|
44
|
-
const stderrPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `stderr.log`);
|
|
45
|
-
const stdoutPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `stdout.log`);
|
|
46
|
-
if (result.metafile) {
|
|
47
|
-
const addableFiles = tree(result.metafile, entryPoint.split("/").slice(1).join("/"))
|
|
48
|
-
.map((y) => {
|
|
49
|
-
if (otherInputs[y]) {
|
|
50
|
-
return Array.from(otherInputs[y]);
|
|
51
|
-
}
|
|
52
|
-
return y;
|
|
53
|
-
})
|
|
54
|
-
.flat();
|
|
55
|
-
const typeErrorFiles = addableFiles.map((t) => `docs/types/${t}.type_errors.txt`);
|
|
56
|
-
const lintPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `lint_errors.txt`);
|
|
57
|
-
fs_1.default.writeFileSync(promptPath, `
|
|
58
|
-
${addableFiles
|
|
59
|
-
.map((x) => {
|
|
60
|
-
return `/add ${x}`;
|
|
61
|
-
})
|
|
62
|
-
.join("\n")}
|
|
63
|
-
|
|
64
|
-
${typeErrorFiles
|
|
65
|
-
.map((x) => {
|
|
66
|
-
return `/read ${x}`;
|
|
67
|
-
})
|
|
68
|
-
.join("\n")}
|
|
69
|
-
|
|
70
|
-
/read ${lintPath}
|
|
71
|
-
/read ${testPaths}
|
|
72
|
-
/read ${stdoutPath}
|
|
73
|
-
/read ${stderrPath}
|
|
74
|
-
|
|
75
|
-
/load ${featuresPath}
|
|
76
|
-
|
|
77
|
-
/code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files [${typeErrorFiles.join(", ")}]. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPath}"
|
|
78
|
-
`);
|
|
79
|
-
const logContent = [];
|
|
80
|
-
const tsc = (0, child_process_1.spawn)("eslint", addableFiles);
|
|
81
|
-
tsc.stdout.on("data", (data) => {
|
|
82
|
-
const lines = data.toString().split("\n");
|
|
83
|
-
logContent.push(...lines);
|
|
84
|
-
});
|
|
85
|
-
tsc.stderr.on("data", (data) => {
|
|
86
|
-
console.error(`stderr: ${data}`);
|
|
87
|
-
process.exit(-1);
|
|
88
|
-
});
|
|
89
|
-
tsc.on("close", (code) => {
|
|
90
|
-
fs_1.default.writeFileSync(lintPath, logContent.join("\n"));
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
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 index_js_1 = __importDefault(require("./index.js"));
|
|
7
|
-
const inputFilesPlugin_js_1 = __importDefault(require("./inputFilesPlugin.js"));
|
|
8
|
-
const featuresPlugin_1 = __importDefault(require("./featuresPlugin"));
|
|
9
|
-
exports.default = (config, entryPoints) => {
|
|
10
|
-
const { inputFilesPluginFactory, register } = (0, inputFilesPlugin_js_1.default)("node", entryPoints);
|
|
11
|
-
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { splitting: true, outdir: config.outdir + "/node",
|
|
12
|
-
// inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
|
|
13
|
-
metafile: true, supported: {
|
|
14
|
-
"dynamic-import": true,
|
|
15
|
-
}, define: {
|
|
16
|
-
"process.env.FLUENTFFMPEG_COV": "0",
|
|
17
|
-
}, absWorkingDir: process.cwd(), banner: {
|
|
18
|
-
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
|
|
19
|
-
}, platform: "node", external: [
|
|
20
|
-
// "testeranto.json",
|
|
21
|
-
// "features.test.js",
|
|
22
|
-
"react",
|
|
23
|
-
// "events",
|
|
24
|
-
// "ganache"
|
|
25
|
-
...config.externals,
|
|
26
|
-
], entryPoints: [...entryPoints], plugins: [
|
|
27
|
-
featuresPlugin_1.default,
|
|
28
|
-
...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
|
|
29
|
-
inputFilesPluginFactory,
|
|
30
|
-
// inputFilesPlugin("node", entryPoints),
|
|
31
|
-
{
|
|
32
|
-
name: "rebuild-notify",
|
|
33
|
-
setup(build) {
|
|
34
|
-
build.onEnd((result) => {
|
|
35
|
-
console.log(`> node build ended with ${result.errors.length} errors`);
|
|
36
|
-
if (result.errors.length > 0) {
|
|
37
|
-
console.log(result);
|
|
38
|
-
}
|
|
39
|
-
// console.log(result);
|
|
40
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
] });
|
|
45
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
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 path_1 = __importDefault(require("path"));
|
|
7
|
-
const index_js_1 = __importDefault(require("./index.js"));
|
|
8
|
-
const inputFilesPlugin_js_1 = __importDefault(require("./inputFilesPlugin.js"));
|
|
9
|
-
const featuresPlugin_js_1 = __importDefault(require("./featuresPlugin.js"));
|
|
10
|
-
exports.default = (config, entryPoints) => {
|
|
11
|
-
const { inputFilesPluginFactory, register } = (0, inputFilesPlugin_js_1.default)("web", entryPoints);
|
|
12
|
-
return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), {
|
|
13
|
-
// inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
|
|
14
|
-
// banner: {
|
|
15
|
-
// js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
|
|
16
|
-
// },
|
|
17
|
-
// splitting: true,
|
|
18
|
-
outdir: config.outdir + "/web", alias: {
|
|
19
|
-
react: path_1.default.resolve("./node_modules/react"),
|
|
20
|
-
}, metafile: true, external: [
|
|
21
|
-
// "testeranto.json",
|
|
22
|
-
// "features.test.ts",
|
|
23
|
-
// "url",
|
|
24
|
-
// "react",
|
|
25
|
-
"path",
|
|
26
|
-
"fs",
|
|
27
|
-
"stream",
|
|
28
|
-
"http",
|
|
29
|
-
"constants",
|
|
30
|
-
"net",
|
|
31
|
-
"assert",
|
|
32
|
-
"tls",
|
|
33
|
-
"os",
|
|
34
|
-
"child_process",
|
|
35
|
-
"readline",
|
|
36
|
-
"zlib",
|
|
37
|
-
"crypto",
|
|
38
|
-
"https",
|
|
39
|
-
"util",
|
|
40
|
-
"process",
|
|
41
|
-
"dns",
|
|
42
|
-
], platform: "browser", entryPoints: [...entryPoints], plugins: [
|
|
43
|
-
featuresPlugin_js_1.default,
|
|
44
|
-
// markdownPlugin({}),
|
|
45
|
-
...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
|
|
46
|
-
inputFilesPluginFactory,
|
|
47
|
-
{
|
|
48
|
-
name: "rebuild-notify",
|
|
49
|
-
setup(build) {
|
|
50
|
-
build.onEnd((result) => {
|
|
51
|
-
console.log(`> web build ended with ${result.errors.length} errors`);
|
|
52
|
-
if (result.errors.length > 0) {
|
|
53
|
-
console.log(result);
|
|
54
|
-
}
|
|
55
|
-
// console.log(result);
|
|
56
|
-
// result.errors.length !== 0 && process.exit(-1);
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
] });
|
|
61
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const fs_1 = __importDefault(require("fs"));
|
|
30
|
-
const Init_1 = __importDefault(require("../dist/module/src/Init"));
|
|
31
|
-
console.log("Initializing a testeranto project");
|
|
32
|
-
if (!process.argv[2]) {
|
|
33
|
-
console.log("You didn't pass a config file, so I will create one for you.");
|
|
34
|
-
fs_1.default.writeFileSync("testeranto.mts", fs_1.default.readFileSync("node_modules/testeranto/src/defaultConfig.ts"));
|
|
35
|
-
Promise.resolve().then(() => __importStar(require(process.cwd() + "/" + "testeranto.mts"))).then((module) => {
|
|
36
|
-
(0, Init_1.default)(module.default);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
Promise.resolve().then(() => __importStar(require(process.cwd() + "/" + process.argv[2]))).then((module) => {
|
|
41
|
-
(0, Init_1.default)(module.default);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
@@ -1,324 +0,0 @@
|
|
|
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
|
-
features() {
|
|
13
|
-
const features = Object.keys(this.givens)
|
|
14
|
-
.map((k) => this.givens[k].features)
|
|
15
|
-
.flat()
|
|
16
|
-
.filter((value, index, array) => {
|
|
17
|
-
return array.indexOf(value) === index;
|
|
18
|
-
});
|
|
19
|
-
// .reduce((mm, lm) => {
|
|
20
|
-
// mm[lm] = lm;
|
|
21
|
-
// return mm;
|
|
22
|
-
// }, {});
|
|
23
|
-
return features || [];
|
|
24
|
-
}
|
|
25
|
-
toObj() {
|
|
26
|
-
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
27
|
-
return {
|
|
28
|
-
name: this.name,
|
|
29
|
-
givens,
|
|
30
|
-
fails: this.fails,
|
|
31
|
-
features: this.features(),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
setup(s, artifactory, tr, pm) {
|
|
35
|
-
return new Promise((res) => res(s));
|
|
36
|
-
}
|
|
37
|
-
assertThat(t) {
|
|
38
|
-
return t;
|
|
39
|
-
}
|
|
40
|
-
afterAll(store, artifactory, pm) {
|
|
41
|
-
return store;
|
|
42
|
-
}
|
|
43
|
-
async run(input, testResourceConfiguration, artifactory, tLog, pm) {
|
|
44
|
-
this.testResourceConfiguration = testResourceConfiguration;
|
|
45
|
-
tLog("test resources: ", JSON.stringify(testResourceConfiguration));
|
|
46
|
-
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
47
|
-
// console.log("\nSuite:", this.index, this.name);
|
|
48
|
-
tLog("\nSuite:", this.index, this.name);
|
|
49
|
-
const sNdx = this.index;
|
|
50
|
-
const sName = this.name;
|
|
51
|
-
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
52
|
-
// console.log("gKey", gKey);
|
|
53
|
-
const beforeAllProxy = new Proxy(pm, {
|
|
54
|
-
get(target, prop, receiver) {
|
|
55
|
-
if (prop === "customScreenShot") {
|
|
56
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), {
|
|
57
|
-
// path: `${filepath}/${opts.path}`,
|
|
58
|
-
path: `suite-${sNdx}/beforeAll/${opts.path}` }), p);
|
|
59
|
-
}
|
|
60
|
-
if (prop === "writeFileSync") {
|
|
61
|
-
return (fp, contents) => target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
|
|
62
|
-
}
|
|
63
|
-
return Reflect.get(...arguments);
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy);
|
|
67
|
-
const giver = this.givens[gKey];
|
|
68
|
-
try {
|
|
69
|
-
this.store = await giver.give(subject, gKey, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx);
|
|
70
|
-
}
|
|
71
|
-
catch (e) {
|
|
72
|
-
console.error(e);
|
|
73
|
-
this.fails.push(giver);
|
|
74
|
-
// return this;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
this.afterAll(this.store, artifactory,
|
|
79
|
-
// afterAllProxy
|
|
80
|
-
pm);
|
|
81
|
-
}
|
|
82
|
-
catch (e) {
|
|
83
|
-
console.error(e);
|
|
84
|
-
// this.fails.push(this);
|
|
85
|
-
// return this;
|
|
86
|
-
}
|
|
87
|
-
// for (const [ndx, thater] of this.checks.entries()) {
|
|
88
|
-
// await thater.check(
|
|
89
|
-
// subject,
|
|
90
|
-
// thater.name,
|
|
91
|
-
// testResourceConfiguration,
|
|
92
|
-
// this.assertThat,
|
|
93
|
-
// suiteArtifactory,
|
|
94
|
-
// tLog,
|
|
95
|
-
// pm
|
|
96
|
-
// );
|
|
97
|
-
// }
|
|
98
|
-
// @TODO fix me
|
|
99
|
-
// for (const k of Object.keys(this.givens)) {
|
|
100
|
-
// const giver = this.givens[k];
|
|
101
|
-
// try {
|
|
102
|
-
// giver.afterAll(this.store, artifactory, pm);
|
|
103
|
-
// } catch (e) {
|
|
104
|
-
// console.error(e);
|
|
105
|
-
// this.fails.push(giver);
|
|
106
|
-
// return this;
|
|
107
|
-
// }
|
|
108
|
-
// }
|
|
109
|
-
////////////////
|
|
110
|
-
return this;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
exports.BaseSuite = BaseSuite;
|
|
114
|
-
class BaseGiven {
|
|
115
|
-
constructor(name, features, whens, thens, givenCB, initialValues
|
|
116
|
-
// key: string
|
|
117
|
-
) {
|
|
118
|
-
this.name = name;
|
|
119
|
-
this.features = features;
|
|
120
|
-
this.whens = whens;
|
|
121
|
-
this.thens = thens;
|
|
122
|
-
this.givenCB = givenCB;
|
|
123
|
-
this.initialValues = initialValues;
|
|
124
|
-
}
|
|
125
|
-
beforeAll(store,
|
|
126
|
-
// artifactory: ITestArtifactory
|
|
127
|
-
// subject,
|
|
128
|
-
initializer, artifactory, testResource, initialValues, pm) {
|
|
129
|
-
return store;
|
|
130
|
-
}
|
|
131
|
-
toObj() {
|
|
132
|
-
return {
|
|
133
|
-
key: this.key,
|
|
134
|
-
name: this.name,
|
|
135
|
-
whens: this.whens.map((w) => w.toObj()),
|
|
136
|
-
thens: this.thens.map((t) => t.toObj()),
|
|
137
|
-
error: this.error ? [this.error, this.error.stack] : null,
|
|
138
|
-
// fail: this.fail ? [this.fail] : false,
|
|
139
|
-
features: this.features,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
async afterEach(store, key, artifactory, pm) {
|
|
143
|
-
return store;
|
|
144
|
-
}
|
|
145
|
-
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
|
|
146
|
-
this.key = key;
|
|
147
|
-
tLog(`\n ${this.key}`);
|
|
148
|
-
tLog(`\n Given: ${this.name}`);
|
|
149
|
-
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
150
|
-
try {
|
|
151
|
-
// tLog(`\n Given this.store`, this.store);
|
|
152
|
-
const beforeEachProxy = new Proxy(pm, {
|
|
153
|
-
get(target, prop, receiver) {
|
|
154
|
-
if (prop === "writeFileSync") {
|
|
155
|
-
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
|
|
156
|
-
}
|
|
157
|
-
if (prop === "customScreenShot") {
|
|
158
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
|
|
159
|
-
}
|
|
160
|
-
if (prop === "screencast") {
|
|
161
|
-
return (opts, p) => target.screencast(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
|
|
162
|
-
}
|
|
163
|
-
return Reflect.get(...arguments);
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
this.uberCatcher((e) => {
|
|
167
|
-
console.error(e);
|
|
168
|
-
this.error = e.error;
|
|
169
|
-
tLog(e.stack);
|
|
170
|
-
});
|
|
171
|
-
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, beforeEachProxy);
|
|
172
|
-
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
173
|
-
await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
|
|
174
|
-
}
|
|
175
|
-
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
176
|
-
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
|
|
177
|
-
tester(t);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
catch (e) {
|
|
181
|
-
console.error(e);
|
|
182
|
-
this.error = e;
|
|
183
|
-
tLog(e.stack);
|
|
184
|
-
// tLog("\u0007"); // bell
|
|
185
|
-
// throw e;
|
|
186
|
-
}
|
|
187
|
-
finally {
|
|
188
|
-
try {
|
|
189
|
-
const afterEachProxy = new Proxy(pm, {
|
|
190
|
-
get(target, prop, receiver) {
|
|
191
|
-
if (prop === "customScreenShot") {
|
|
192
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/afterEach/${opts.path}` }), p);
|
|
193
|
-
}
|
|
194
|
-
if (prop === "writeFileSync") {
|
|
195
|
-
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterEach/${fp}`, contents);
|
|
196
|
-
}
|
|
197
|
-
return Reflect.get(...arguments);
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
await this.afterEach(this.store, this.key, givenArtifactory,
|
|
201
|
-
// pm
|
|
202
|
-
afterEachProxy);
|
|
203
|
-
}
|
|
204
|
-
catch (e) {
|
|
205
|
-
console.error("afterEach failed! no error will be recorded!", e);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return this.store;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
exports.BaseGiven = BaseGiven;
|
|
212
|
-
class BaseWhen {
|
|
213
|
-
constructor(name, whenCB) {
|
|
214
|
-
this.name = name;
|
|
215
|
-
this.whenCB = whenCB;
|
|
216
|
-
}
|
|
217
|
-
toObj() {
|
|
218
|
-
return {
|
|
219
|
-
name: this.name,
|
|
220
|
-
error: this.error,
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
224
|
-
tLog(" When:", this.name);
|
|
225
|
-
const name = this.name;
|
|
226
|
-
const andWhenProxy = new Proxy(pm, {
|
|
227
|
-
get(target, prop, receiver) {
|
|
228
|
-
if (prop === "customScreenShot") {
|
|
229
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
|
|
230
|
-
}
|
|
231
|
-
if (prop === "writeFileSync") {
|
|
232
|
-
return (fp, contents) => target[prop](`${filepath}/andWhen/${fp}`, contents);
|
|
233
|
-
}
|
|
234
|
-
return Reflect.get(...arguments);
|
|
235
|
-
},
|
|
236
|
-
});
|
|
237
|
-
return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy).catch((e) => {
|
|
238
|
-
this.error = true;
|
|
239
|
-
// throw e;
|
|
240
|
-
});
|
|
241
|
-
// try {
|
|
242
|
-
// return await this.andWhen(
|
|
243
|
-
// store,
|
|
244
|
-
// this.whenCB,
|
|
245
|
-
// testResourceConfiguration,
|
|
246
|
-
// andWhenProxy
|
|
247
|
-
// );
|
|
248
|
-
// } catch (e) {
|
|
249
|
-
// this.error = true;
|
|
250
|
-
// throw e;
|
|
251
|
-
// }
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
exports.BaseWhen = BaseWhen;
|
|
255
|
-
class BaseThen {
|
|
256
|
-
constructor(name, thenCB) {
|
|
257
|
-
this.name = name;
|
|
258
|
-
this.thenCB = thenCB;
|
|
259
|
-
this.error = false;
|
|
260
|
-
}
|
|
261
|
-
toObj() {
|
|
262
|
-
return {
|
|
263
|
-
name: this.name,
|
|
264
|
-
error: this.error,
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
268
|
-
tLog(" Then:", this.name);
|
|
269
|
-
try {
|
|
270
|
-
const butThenProxy = new Proxy(pm, {
|
|
271
|
-
get(target, prop, receiver) {
|
|
272
|
-
if (prop === "customScreenShot") {
|
|
273
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
|
|
274
|
-
}
|
|
275
|
-
if (prop === "writeFileSync") {
|
|
276
|
-
return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
|
|
277
|
-
}
|
|
278
|
-
return Reflect.get(...arguments);
|
|
279
|
-
},
|
|
280
|
-
});
|
|
281
|
-
return this.butThen(store, this.thenCB, testResourceConfiguration, butThenProxy).catch((e) => {
|
|
282
|
-
this.error = true;
|
|
283
|
-
throw e;
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
catch (e) {
|
|
287
|
-
console.log("test failed", e);
|
|
288
|
-
this.error = e.message;
|
|
289
|
-
throw e;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
exports.BaseThen = BaseThen;
|
|
294
|
-
class BaseCheck {
|
|
295
|
-
constructor(name, features, checkCB, whens, thens) {
|
|
296
|
-
this.name = name;
|
|
297
|
-
this.features = features;
|
|
298
|
-
this.checkCB = checkCB;
|
|
299
|
-
this.whens = whens;
|
|
300
|
-
this.thens = thens;
|
|
301
|
-
}
|
|
302
|
-
async afterEach(store, key, cb, pm) {
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm) {
|
|
306
|
-
tLog(`\n Check: ${this.name}`);
|
|
307
|
-
const store = await this.checkThat(subject, testResourceConfiguration, artifactory);
|
|
308
|
-
await this.checkCB(Object.entries(this.whens).reduce((a, [key, when]) => {
|
|
309
|
-
a[key] = async (payload) => {
|
|
310
|
-
return await when(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm, "x");
|
|
311
|
-
};
|
|
312
|
-
return a;
|
|
313
|
-
}, {}), Object.entries(this.thens).reduce((a, [key, then]) => {
|
|
314
|
-
a[key] = async (payload) => {
|
|
315
|
-
const t = await then(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, pm);
|
|
316
|
-
tester(t);
|
|
317
|
-
};
|
|
318
|
-
return a;
|
|
319
|
-
}, {}));
|
|
320
|
-
await this.afterEach(store, key, () => { }, pm);
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
exports.BaseCheck = BaseCheck;
|
|
@@ -1,85 +0,0 @@
|
|
|
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, 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
|
-
this.testJobs = this.specs.map((suite) => {
|
|
18
|
-
const suiteRunner = (suite) => async (puppetMaster, tLog) => {
|
|
19
|
-
const x = await suite.run(input, puppetMaster.testResourceConfiguration, (fPath, value) => puppetMaster.testArtiFactoryfileWriter(tLog, (p) => {
|
|
20
|
-
this.artifacts.push(p);
|
|
21
|
-
})(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value), tLog, puppetMaster);
|
|
22
|
-
return x;
|
|
23
|
-
};
|
|
24
|
-
const runner = suiteRunner(suite);
|
|
25
|
-
return {
|
|
26
|
-
test: suite,
|
|
27
|
-
toObj: () => {
|
|
28
|
-
return suite.toObj();
|
|
29
|
-
},
|
|
30
|
-
runner,
|
|
31
|
-
receiveTestResourceConfig: async function (puppetMaster) {
|
|
32
|
-
const logFilePath = "log.txt";
|
|
33
|
-
const access = await puppetMaster.createWriteStream(logFilePath);
|
|
34
|
-
const tLog = (...l) => {
|
|
35
|
-
puppetMaster.write(access, `${l.toString()}\n`);
|
|
36
|
-
};
|
|
37
|
-
const suiteDone = await runner(puppetMaster, tLog);
|
|
38
|
-
const logPromise = new Promise((res, rej) => {
|
|
39
|
-
puppetMaster.end(access);
|
|
40
|
-
res(true);
|
|
41
|
-
});
|
|
42
|
-
const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
|
|
43
|
-
return suiteDone.givens[k].error;
|
|
44
|
-
}).length;
|
|
45
|
-
puppetMaster.writeFileSync(`exitcode`, numberOfFailures.toString());
|
|
46
|
-
// if (numberOfFailures > 0) {
|
|
47
|
-
// puppetMaster.writeFileSync(
|
|
48
|
-
// `prompt`,
|
|
49
|
-
// `
|
|
50
|
-
// aider --message "make a script that prints hello" hello.js
|
|
51
|
-
// `
|
|
52
|
-
// );
|
|
53
|
-
// }
|
|
54
|
-
puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
|
|
55
|
-
// console.log(`exiting gracefully with ${numberOfFailures} failures.`);
|
|
56
|
-
return {
|
|
57
|
-
failed: numberOfFailures,
|
|
58
|
-
artifacts: this.artifacts || [],
|
|
59
|
-
logPromise,
|
|
60
|
-
features: suiteDone.features(),
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
Specs() {
|
|
67
|
-
return this.specs;
|
|
68
|
-
}
|
|
69
|
-
Suites() {
|
|
70
|
-
return this.suitesOverrides;
|
|
71
|
-
}
|
|
72
|
-
Given() {
|
|
73
|
-
return this.givenOverides;
|
|
74
|
-
}
|
|
75
|
-
When() {
|
|
76
|
-
return this.whenOverides;
|
|
77
|
-
}
|
|
78
|
-
Then() {
|
|
79
|
-
return this.thenOverides;
|
|
80
|
-
}
|
|
81
|
-
Check() {
|
|
82
|
-
return this.checkOverides;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.BaseBuilder = BaseBuilder;
|