testeranto 0.166.0 → 0.171.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/dist/common/src/NavBar.js +45 -0
- package/dist/common/src/PM/main.js +81 -59
- package/dist/common/src/Pure.js +17 -15
- package/dist/common/src/ReportServer.js +48 -5
- package/dist/common/src/Web.js +35 -20
- package/dist/common/src/components/SunriseAnimation.test/implementation.js +1 -0
- package/dist/common/src/components/SunriseAnimation.test/index.js +1 -0
- package/dist/common/src/components/SunriseAnimation.test/interface.js +1 -0
- package/dist/common/src/components/SunriseAnimation.test/specification.js +1 -0
- package/dist/common/src/components/TestStatusBadge.js +55 -0
- package/dist/common/src/components/pure/ProjectPageView.js +204 -0
- package/dist/common/src/components/pure/ProjectPageView.test/adapter.js +20 -0
- package/dist/common/src/components/pure/ProjectPageView.test/implementation.js +71 -0
- package/dist/common/src/components/pure/ProjectPageView.test/index.js +10 -0
- package/dist/common/src/components/pure/ProjectPageView.test/specification.js +19 -0
- package/dist/common/src/components/pure/ProjectPageView.test/types.js +2 -0
- package/dist/common/src/lib/BaseSuite.js +3 -3
- package/dist/common/src/lib/BaseSuite.test/test.js +1 -1
- package/dist/common/src/lib/abstractBase.js +41 -14
- package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.adapter.js +1 -1
- package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.mock.js +1 -1
- package/dist/common/src/lib/basebuilder.js +9 -7
- package/dist/common/src/lib/core.test/MockCore.js +17 -15
- package/dist/common/src/lib/pmProxy.js +185 -64
- package/dist/common/testeranto.config.js +6 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/App.js +3 -3
- package/dist/module/src/PM/main.js +81 -59
- package/dist/module/src/ProjectsPage.js +1 -110
- package/dist/module/src/Pure.js +17 -15
- package/dist/module/src/ReportServer.js +48 -5
- package/dist/module/src/TestPage.js +45 -16
- package/dist/module/src/Web.js +35 -20
- package/dist/module/src/components/SunriseAnimation.test/implementation.js +1 -0
- package/dist/module/src/components/SunriseAnimation.test/index.js +1 -0
- package/dist/module/src/components/SunriseAnimation.test/interface.js +1 -0
- package/dist/module/src/components/SunriseAnimation.test/specification.js +1 -0
- package/dist/module/src/components/pure/ProjectPageView.js +197 -0
- package/dist/module/src/components/pure/ProjectPageView.test/adapter.js +17 -0
- package/dist/module/src/components/pure/ProjectPageView.test/implementation.js +68 -0
- package/dist/module/src/components/pure/ProjectPageView.test/index.js +5 -0
- package/dist/module/src/components/pure/ProjectPageView.test/specification.js +15 -0
- package/dist/module/src/components/pure/ProjectPageView.test/types.js +1 -0
- package/dist/module/src/components/pure/ProjectsPageView.js +58 -0
- package/dist/module/src/components/pure/TestPageView.js +136 -0
- package/dist/module/src/components/stateful/ProjectPage.js +63 -0
- package/dist/module/src/components/stateful/ProjectsPage.js +55 -0
- package/dist/module/src/components/stateful/TestPage.js +82 -0
- package/dist/module/src/lib/BaseSuite.js +3 -3
- package/dist/module/src/lib/BaseSuite.test/test.js +1 -1
- package/dist/module/src/lib/abstractBase.js +41 -14
- package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.adapter.js +1 -1
- package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.mock.js +1 -1
- package/dist/module/src/lib/basebuilder.js +9 -7
- package/dist/module/src/lib/core.test/MockCore.js +17 -15
- package/dist/module/src/lib/pmProxy.js +185 -64
- package/dist/module/testeranto.config.js +6 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/App.js +541 -495
- package/dist/prebuild/ReportServer.mjs +44 -4
- package/dist/prebuild/run.mjs +67 -39
- package/dist/types/src/NavBar.d.ts +19 -0
- package/dist/types/src/PM/index.d.ts +3 -1
- package/dist/types/src/PM/main.d.ts +0 -4
- package/dist/types/src/PM/node.d.ts +2 -2
- package/dist/types/src/components/SunriseAnimation.test/interface.d.ts +0 -0
- package/dist/types/src/components/SunriseAnimation.test/specification.d.ts +0 -0
- package/dist/types/src/components/TestStatusBadge.d.ts +15 -0
- package/dist/types/src/components/pure/ProjectPageView.d.ts +14 -0
- package/dist/types/src/components/pure/ProjectPageView.test/adapter.d.ts +3 -0
- package/dist/types/src/components/pure/ProjectPageView.test/implementation.d.ts +3 -0
- package/dist/types/src/components/pure/ProjectPageView.test/index.d.ts +3 -0
- package/dist/types/src/components/pure/ProjectPageView.test/specification.d.ts +3 -0
- package/dist/types/src/components/pure/ProjectPageView.test/types.d.ts +39 -0
- package/dist/types/src/lib/BaseSuite.d.ts +2 -0
- package/dist/types/src/lib/abstractBase.d.ts +12 -0
- package/dist/types/src/lib/index.d.ts +0 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/App.tsx +5 -9
- package/src/PM/index.ts +1 -1
- package/src/PM/main.ts +87 -82
- package/src/PM/node.ts +2 -2
- package/src/ProjectsPage.tsx +1 -164
- package/src/Pure.ts +17 -17
- package/src/ReportServer.ts +49 -6
- package/src/TestPage.tsx +78 -5
- package/src/Web.ts +35 -35
- package/src/components/SunriseAnimation.test/implementation.ts +0 -0
- package/src/components/SunriseAnimation.test/index.ts +0 -0
- package/src/components/SunriseAnimation.test/interface.ts +0 -0
- package/src/components/SunriseAnimation.test/specification.ts +0 -0
- package/src/components/pure/ProjectPageView.test/adapter.ts +21 -0
- package/src/components/pure/ProjectPageView.test/implementation.tsx +84 -0
- package/src/components/pure/ProjectPageView.test/index.ts +8 -0
- package/src/components/pure/ProjectPageView.test/specification.ts +31 -0
- package/src/components/pure/ProjectPageView.test/types.ts +55 -0
- package/src/components/pure/ProjectPageView.tsx +332 -0
- package/src/components/pure/ProjectsPageView.tsx +99 -0
- package/src/components/pure/TestPageView.tsx +278 -0
- package/src/components/stateful/ProjectPage.tsx +83 -0
- package/src/components/stateful/ProjectsPage.tsx +73 -0
- package/src/components/stateful/TestPage.tsx +107 -0
- package/src/lib/BaseSuite.test/test.ts +1 -1
- package/src/lib/BaseSuite.ts +9 -4
- package/src/lib/abstractBase.ts +45 -14
- package/src/lib/baseBuilder.test/baseBuilder.test.adapter.ts +1 -1
- package/src/lib/baseBuilder.test/baseBuilder.test.mock.ts +1 -1
- package/src/lib/basebuilder.ts +9 -9
- package/src/lib/core.test/MockCore.ts +26 -19
- package/src/lib/index.ts +1 -1
- package/src/lib/pmProxy.ts +184 -87
- package/testeranto/App.js +541 -495
- package/testeranto/bundles/node/allTests/{chunk-4ONUZRZ4.mjs → chunk-3EUGBAOM.mjs} +1 -1
- package/testeranto/bundles/node/allTests/{chunk-FFBRDUBH.mjs → chunk-E75CSRER.mjs} +247 -124
- package/testeranto/bundles/node/allTests/{chunk-NQEP7SN4.mjs → chunk-M6DO7VMB.mjs} +1 -1
- package/testeranto/bundles/node/allTests/metafile.json +41 -41
- package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test/node.test.mjs +4 -4
- package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +4 -4
- package/testeranto/bundles/node/allTests/src/lib/classBuilder.test/classBuilder.test.mjs +3 -3
- package/testeranto/bundles/node/allTests/src/lib/core.test/core.test.mjs +11 -23
- package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +2 -2
- package/testeranto/bundles/pure/allTests/{chunk-CSMXYJ65.mjs → chunk-KHDVEHF7.mjs} +3 -18
- package/testeranto/bundles/pure/allTests/{chunk-QK4IXLF6.mjs → chunk-VMUSFSZM.mjs} +247 -124
- package/testeranto/bundles/pure/allTests/metafile.json +77 -47
- package/testeranto/bundles/pure/allTests/src/Pure.test.mjs +2 -2
- package/testeranto/bundles/pure/allTests/src/lib/BaseSuite.test/pure.test.mjs +3 -3
- package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +3 -30
- package/testeranto/bundles/web/allTests/chunk-HPYA4YZC.mjs +2283 -0
- package/testeranto/bundles/web/allTests/{chunk-TU3MJSSI.mjs → chunk-RLDR6LJN.mjs} +302 -127
- package/testeranto/bundles/web/allTests/chunk-U7AW26HL.mjs +997 -0
- package/testeranto/bundles/web/allTests/metafile.json +15065 -46
- package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.html +19 -0
- package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.mjs +37524 -0
- package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.mjs +20 -2
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +27 -3
- package/testeranto/reports/allTests/config.json +8 -0
- package/testeranto/reports/allTests/src/Pure.test/pure/type_errors.txt +9 -3
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/bdd_errors.txt +1 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +13 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/logs.txt +50 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/message.txt +2 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/prompt.txt +17 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/tests.json +32 -0
- package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +68 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +0 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/tests.json +6 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/type_errors.txt +8 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/tests.json +6 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +9 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +0 -0
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/prompt.txt +2 -2
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/tests.json +6 -3
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/type_errors.txt +10 -5
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +0 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +18 -9
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +8 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +10 -5
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +0 -0
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +2 -2
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +18 -9
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +10 -5
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +0 -0
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/tests.json +36 -18
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/type_errors.txt +8 -1
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/lint_errors.txt +0 -12
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/logs.txt +2 -2
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/type_errors.txt +11 -8
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +0 -0
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/tests.json +28 -14
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/type_errors.txt +8 -1
- package/testeranto/reports/allTests/summary.json +16 -9
- package/testeranto/reportsweb_build_errors +25 -0
- package/testeranto.config.ts +7 -0
- package/tsc.log +313 -237
- package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test/manifest.json +0 -1
- package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/manifest.json +0 -1
- package/testeranto/reports/allTests/src/Pure.test/pure/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/core.test/core.test/node/manifest.json +0 -1
- package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/manifest.json +0 -1
- /package/{testeranto/reports/allTests/src/Pure.test/pure/logs.txt → dist/types/src/components/SunriseAnimation.test/implementation.d.ts} +0 -0
- /package/{testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/logs.txt → dist/types/src/components/SunriseAnimation.test/index.d.ts} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
|
3
|
+
import { TestPageView } from '../pure/TestPageView';
|
|
4
|
+
import { fetchTestData } from '../../utils/api';
|
|
5
|
+
export const TestPage = () => {
|
|
6
|
+
const navigate = useNavigate();
|
|
7
|
+
const location = useLocation();
|
|
8
|
+
const [route, setRoute] = useState('results');
|
|
9
|
+
// Sync route with hash changes
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const hash = location.hash.replace('#', '');
|
|
12
|
+
if (hash && ['results', 'logs', 'types', 'lint', 'coverage'].includes(hash)) {
|
|
13
|
+
setRoute(hash);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
setRoute('results');
|
|
17
|
+
}
|
|
18
|
+
}, [location.hash]);
|
|
19
|
+
const [testName, setTestName] = useState('');
|
|
20
|
+
const [testData, setTestData] = useState(null);
|
|
21
|
+
const [logs, setLogs] = useState('');
|
|
22
|
+
const [typeErrors, setTypeErrors] = useState('');
|
|
23
|
+
const [lintErrors, setLintErrors] = useState('');
|
|
24
|
+
const [loading, setLoading] = useState(true);
|
|
25
|
+
const [error, setError] = useState(null);
|
|
26
|
+
const [testsExist, setTestsExist] = useState(true);
|
|
27
|
+
const [errorCounts, setErrorCounts] = useState({
|
|
28
|
+
typeErrors: 0,
|
|
29
|
+
staticErrors: 0,
|
|
30
|
+
runTimeErrors: 0
|
|
31
|
+
});
|
|
32
|
+
const [summary, setSummary] = useState(null);
|
|
33
|
+
const { projectName, '*': splat } = useParams();
|
|
34
|
+
const pathParts = splat ? splat.split('/') : [];
|
|
35
|
+
const runtime = pathParts.pop() || '';
|
|
36
|
+
const testPath = pathParts.join('/');
|
|
37
|
+
const decodedTestPath = testPath ? decodeURIComponent(testPath) : '';
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!projectName || !testPath || !runtime)
|
|
40
|
+
return;
|
|
41
|
+
setTestName(testPath);
|
|
42
|
+
const fetchData = async () => {
|
|
43
|
+
try {
|
|
44
|
+
const testResponse = await fetchTestData(projectName, testPath, runtime);
|
|
45
|
+
setTestData(testResponse.testData);
|
|
46
|
+
setTestsExist(!!testResponse.testData);
|
|
47
|
+
setLogs(testResponse.logs === null ? undefined : testResponse.logs);
|
|
48
|
+
setTypeErrors(testResponse.typeErrors);
|
|
49
|
+
setLintErrors(testResponse.lintErrors);
|
|
50
|
+
try {
|
|
51
|
+
const summaryResponse = await fetch(`reports/${projectName}/summary.json`);
|
|
52
|
+
if (!summaryResponse.ok)
|
|
53
|
+
throw new Error('Failed to fetch summary');
|
|
54
|
+
const allSummaries = await summaryResponse.json();
|
|
55
|
+
const testSummary = allSummaries[testPath];
|
|
56
|
+
if (testSummary) {
|
|
57
|
+
const counts = {
|
|
58
|
+
typeErrors: Number(testSummary.typeErrors) || 0,
|
|
59
|
+
staticErrors: Number(testSummary.staticErrors) || 0,
|
|
60
|
+
runTimeErrors: Number(testSummary.runTimeErrors) || 0
|
|
61
|
+
};
|
|
62
|
+
setSummary(testSummary);
|
|
63
|
+
setErrorCounts(counts);
|
|
64
|
+
setTestsExist(testSummary.testsExist !== false);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
console.error('Failed to load summary:', err);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
73
|
+
setTestsExist(false);
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
setLoading(false);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
fetchData();
|
|
80
|
+
}, []);
|
|
81
|
+
return (React.createElement(TestPageView, { route: route, setRoute: setRoute, navigate: navigate, projectName: projectName, testName: testName, decodedTestPath: decodedTestPath, runtime: runtime, testData: testData, logs: logs, typeErrors: typeErrors, lintErrors: lintErrors, loading: loading, error: error, testsExist: testsExist, errorCounts: errorCounts, summary: summary }));
|
|
82
|
+
};
|
|
@@ -11,7 +11,7 @@ export class BaseSuite {
|
|
|
11
11
|
this.givens = givens;
|
|
12
12
|
this.fails = 0;
|
|
13
13
|
console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
|
|
14
|
-
console.log("[DEBUG] BaseSuite givens:", Object.keys(givens));
|
|
14
|
+
console.log("[DEBUG] BaseSuite givens:", Object.keys(givens).toString());
|
|
15
15
|
}
|
|
16
16
|
features() {
|
|
17
17
|
try {
|
|
@@ -21,7 +21,7 @@ export class BaseSuite {
|
|
|
21
21
|
.filter((value, index, array) => {
|
|
22
22
|
return array.indexOf(value) === index;
|
|
23
23
|
});
|
|
24
|
-
console.debug("[DEBUG] Features extracted:", features);
|
|
24
|
+
console.debug("[DEBUG] Features extracted:", features.toString());
|
|
25
25
|
return features || [];
|
|
26
26
|
}
|
|
27
27
|
catch (e) {
|
|
@@ -64,7 +64,7 @@ export class BaseSuite {
|
|
|
64
64
|
.catch((e) => {
|
|
65
65
|
this.failed = true;
|
|
66
66
|
this.fails = this.fails + 1;
|
|
67
|
-
console.error("Given error 1:", e);
|
|
67
|
+
// console.error("Given error 1:", e.toString());
|
|
68
68
|
throw e;
|
|
69
69
|
});
|
|
70
70
|
}
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
import { afterEachProxy, andWhenProxy, beforeEachProxy, butThenProxy, } from "./pmProxy.js";
|
|
4
4
|
export class BaseGiven {
|
|
5
|
+
addArtifact(path) {
|
|
6
|
+
console.log(`[Artifact] Adding to ${this.constructor.name}:`, path);
|
|
7
|
+
this.artifacts.push(path);
|
|
8
|
+
}
|
|
5
9
|
constructor(name, features, whens, thens, givenCB, initialValues) {
|
|
10
|
+
this.artifacts = [];
|
|
6
11
|
this.name = name;
|
|
7
12
|
this.features = features;
|
|
8
13
|
this.whens = whens;
|
|
@@ -20,13 +25,14 @@ export class BaseGiven {
|
|
|
20
25
|
whens: this.whens.map((w) => {
|
|
21
26
|
if (w && w.toObj)
|
|
22
27
|
return w.toObj();
|
|
23
|
-
console.error("w is not as expected!", w);
|
|
28
|
+
console.error("w is not as expected!", w.toString());
|
|
24
29
|
return {};
|
|
25
30
|
}),
|
|
26
31
|
thens: this.thens.map((t) => t.toObj()),
|
|
27
32
|
error: this.error ? [this.error, this.error.stack] : null,
|
|
28
33
|
failed: this.failed,
|
|
29
34
|
features: this.features,
|
|
35
|
+
artifacts: this.artifacts,
|
|
30
36
|
};
|
|
31
37
|
}
|
|
32
38
|
async afterEach(store, key, artifactory, pm) {
|
|
@@ -38,15 +44,18 @@ export class BaseGiven {
|
|
|
38
44
|
tLog(`\n Given: ${this.name}`);
|
|
39
45
|
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
40
46
|
this.uberCatcher((e) => {
|
|
41
|
-
console.error(e);
|
|
47
|
+
console.error(e.toString());
|
|
42
48
|
this.error = e.error;
|
|
43
49
|
tLog(e.stack);
|
|
44
50
|
});
|
|
45
51
|
try {
|
|
46
|
-
|
|
52
|
+
const proxiedPm = beforeEachProxy(pm, suiteNdx.toString());
|
|
53
|
+
console.log(`[Given] Setting currentStep for beforeEach:`, this.name);
|
|
54
|
+
proxiedPm.currentStep = this;
|
|
55
|
+
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, proxiedPm);
|
|
47
56
|
}
|
|
48
57
|
catch (e) {
|
|
49
|
-
console.error("failure
|
|
58
|
+
console.error("Given failure: ", e.toString());
|
|
50
59
|
this.error = e;
|
|
51
60
|
throw e;
|
|
52
61
|
}
|
|
@@ -73,7 +82,7 @@ export class BaseGiven {
|
|
|
73
82
|
await this.afterEach(this.store, this.key, givenArtifactory, afterEachProxy(pm, suiteNdx.toString(), key));
|
|
74
83
|
}
|
|
75
84
|
catch (e) {
|
|
76
|
-
console.error("afterEach failed!", e);
|
|
85
|
+
console.error("afterEach failed!", e.toString());
|
|
77
86
|
this.failed = e;
|
|
78
87
|
throw e;
|
|
79
88
|
// this.error = e.message;
|
|
@@ -84,26 +93,39 @@ export class BaseGiven {
|
|
|
84
93
|
}
|
|
85
94
|
export class BaseWhen {
|
|
86
95
|
constructor(name, whenCB) {
|
|
96
|
+
this.artifacts = [];
|
|
87
97
|
this.name = name;
|
|
88
98
|
this.whenCB = whenCB;
|
|
89
99
|
}
|
|
90
100
|
toObj() {
|
|
91
101
|
console.log("toObj error", this.error);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
if (this.error) {
|
|
103
|
+
return {
|
|
104
|
+
name: this.name,
|
|
105
|
+
error: this.error && this.error.name + this.error.stack,
|
|
106
|
+
artifacts: this.artifacts,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
return {
|
|
111
|
+
name: this.name,
|
|
112
|
+
artifacts: this.artifacts,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
96
115
|
}
|
|
97
116
|
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
98
117
|
try {
|
|
99
118
|
tLog(" When:", this.name);
|
|
100
|
-
console.debug("[DEBUG] Executing When step:", this.name);
|
|
101
|
-
const
|
|
102
|
-
console.
|
|
119
|
+
console.debug("[DEBUG] Executing When step:", this.name.toString());
|
|
120
|
+
const proxiedPm = andWhenProxy(pm, filepath);
|
|
121
|
+
console.log(`[When] Setting currentStep for andWhen:`, this.name);
|
|
122
|
+
proxiedPm.currentStep = this;
|
|
123
|
+
const result = await this.andWhen(store, this.whenCB, testResourceConfiguration, proxiedPm);
|
|
124
|
+
console.debug("[DEBUG] When step completed:", this.name.toString());
|
|
103
125
|
return result;
|
|
104
126
|
}
|
|
105
127
|
catch (e) {
|
|
106
|
-
console.error("[ERROR] When step failed:", this.name, e);
|
|
128
|
+
console.error("[ERROR] When step failed:", this.name.toString(), e.toString());
|
|
107
129
|
this.error = e;
|
|
108
130
|
throw e;
|
|
109
131
|
}
|
|
@@ -111,6 +133,7 @@ export class BaseWhen {
|
|
|
111
133
|
}
|
|
112
134
|
export class BaseThen {
|
|
113
135
|
constructor(name, thenCB) {
|
|
136
|
+
this.artifacts = [];
|
|
114
137
|
this.name = name;
|
|
115
138
|
this.thenCB = thenCB;
|
|
116
139
|
this.error = false;
|
|
@@ -119,12 +142,16 @@ export class BaseThen {
|
|
|
119
142
|
return {
|
|
120
143
|
name: this.name,
|
|
121
144
|
error: this.error,
|
|
145
|
+
artifacts: this.artifacts,
|
|
122
146
|
};
|
|
123
147
|
}
|
|
124
148
|
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
149
|
+
const proxiedPm = butThenProxy(pm, filepath);
|
|
150
|
+
console.log(`[Then] Setting currentStep for butThen:`, this.name);
|
|
151
|
+
proxiedPm.currentStep = this;
|
|
125
152
|
return this.butThen(store, async (s) => {
|
|
126
153
|
if (typeof this.thenCB === "function") {
|
|
127
|
-
return await this.thenCB(s);
|
|
154
|
+
return await this.thenCB(s, proxiedPm);
|
|
128
155
|
}
|
|
129
156
|
else {
|
|
130
157
|
return this.thenCB;
|
|
@@ -7,7 +7,7 @@ export const testAdapter = {
|
|
|
7
7
|
initialValues,
|
|
8
8
|
});
|
|
9
9
|
const result = initializer();
|
|
10
|
-
console.log("Initialization result:", result);
|
|
10
|
+
console.log("Initialization result:", result.toString());
|
|
11
11
|
return result;
|
|
12
12
|
},
|
|
13
13
|
andWhen: async (store, whenCB, testResource, utils) => {
|
|
@@ -28,17 +28,19 @@ export class BaseBuilder {
|
|
|
28
28
|
},
|
|
29
29
|
runner,
|
|
30
30
|
receiveTestResourceConfig: async function (puppetMaster) {
|
|
31
|
-
const logFilePath = "logs.txt";
|
|
32
|
-
const access = await puppetMaster.createWriteStream(
|
|
31
|
+
// const logFilePath = "logs.txt";
|
|
32
|
+
// const access: number = await puppetMaster.createWriteStream(
|
|
33
|
+
// logFilePath
|
|
34
|
+
// );
|
|
33
35
|
// deprecated?
|
|
34
36
|
const tLog = async (...l) => {
|
|
35
37
|
//
|
|
36
38
|
};
|
|
37
39
|
const suiteDone = await runner(puppetMaster, tLog);
|
|
38
|
-
const logPromise = new Promise(async (res) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
40
|
+
// const logPromise = new Promise(async (res) => {
|
|
41
|
+
// await puppetMaster.end(access);
|
|
42
|
+
// res(true);
|
|
43
|
+
// });
|
|
42
44
|
const fails = suiteDone.fails;
|
|
43
45
|
await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
|
|
44
46
|
await puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
|
|
@@ -46,7 +48,7 @@ export class BaseBuilder {
|
|
|
46
48
|
failed: fails > 0,
|
|
47
49
|
fails,
|
|
48
50
|
artifacts: this.artifacts || [],
|
|
49
|
-
logPromise,
|
|
51
|
+
// logPromise,
|
|
50
52
|
features: suiteDone.features(),
|
|
51
53
|
};
|
|
52
54
|
},
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
3
|
import TesterantoCore from "../core";
|
|
2
4
|
/**
|
|
3
5
|
* Concrete implementation of Testeranto for testing purposes
|
|
4
6
|
*/
|
|
5
7
|
export class MockCore extends TesterantoCore {
|
|
6
8
|
constructor(input, testSpecification, testImplementation, testResourceRequirement = { ports: [] }, testAdapter, uberCatcher = (cb) => cb()) {
|
|
7
|
-
console.log(
|
|
9
|
+
console.log("[DEBUG] MockCore constructor starting...");
|
|
8
10
|
if (!testImplementation) {
|
|
9
|
-
throw new Error(
|
|
11
|
+
throw new Error("testImplementation is required");
|
|
10
12
|
}
|
|
11
13
|
if (!testSpecification) {
|
|
12
|
-
console.warn(
|
|
14
|
+
console.warn("[WARN] testSpecification is null/undefined - tests may fail");
|
|
13
15
|
}
|
|
14
|
-
console.log(
|
|
15
|
-
console.log(
|
|
16
|
-
console.log(
|
|
17
|
-
console.log(
|
|
18
|
-
console.log(
|
|
19
|
-
console.log(
|
|
16
|
+
console.log("[DEBUG] MockCore constructor called with:");
|
|
17
|
+
console.log("- input:", JSON.stringify(input, null, 2));
|
|
18
|
+
console.log("- testSpecification keys:", Object.keys(testSpecification));
|
|
19
|
+
console.log("- testImplementation keys:", Object.keys(testImplementation));
|
|
20
|
+
console.log("- testResourceRequirement:", JSON.stringify(testResourceRequirement));
|
|
21
|
+
console.log("- testAdapter keys:", Object.keys(testAdapter));
|
|
20
22
|
// Validate required implementation methods
|
|
21
|
-
const requiredMethods = [
|
|
22
|
-
requiredMethods.forEach(method => {
|
|
23
|
+
const requiredMethods = ["suites", "givens", "whens", "thens"];
|
|
24
|
+
requiredMethods.forEach((method) => {
|
|
23
25
|
if (!testImplementation[method]) {
|
|
24
26
|
throw new Error(`Missing required implementation method: ${method}`);
|
|
25
27
|
}
|
|
26
28
|
});
|
|
27
|
-
console.log(
|
|
28
|
-
this.testResourceRequirement = testResourceRequirement;
|
|
29
|
-
this.testAdapter = testAdapter;
|
|
29
|
+
console.log("[DEBUG] Validation passed, calling super...");
|
|
30
|
+
// this.testResourceRequirement = testResourceRequirement;
|
|
31
|
+
// this.testAdapter = testAdapter;
|
|
30
32
|
super(input, testSpecification, testImplementation, testResourceRequirement, testAdapter, uberCatcher);
|
|
31
33
|
this.specs = [];
|
|
32
34
|
this.testJobs = [];
|
|
@@ -37,7 +39,7 @@ export class MockCore extends TesterantoCore {
|
|
|
37
39
|
failed: false,
|
|
38
40
|
fails: 0,
|
|
39
41
|
artifacts: [],
|
|
40
|
-
logPromise: Promise.resolve(),
|
|
42
|
+
// logPromise: Promise.resolve(),
|
|
41
43
|
features: [],
|
|
42
44
|
};
|
|
43
45
|
}
|