testeranto 0.219.13 → 0.219.15
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/testeranto.ts +1 -1
- package/dist/common/allTestsUtils.js +0 -17
- package/dist/common/package.json +0 -3
- package/dist/common/scripts/build-example.js +0 -105
- package/dist/common/src/Init.js +0 -38
- package/dist/common/src/Types.js +0 -63
- package/dist/common/src/esbuildConfigs/consoleDetectorPlugin.js +0 -38
- package/dist/common/src/esbuildConfigs/eslint-formatter-testeranto.js +0 -21
- package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
- package/dist/common/src/esbuildConfigs/index.js +0 -22
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -30
- package/dist/common/src/esbuildConfigs/nativeImportDetectorPlugin.js +0 -24
- package/dist/common/src/esbuildConfigs/rebuildPlugin.js +0 -19
- package/dist/common/src/init-docs.js +0 -9
- package/dist/common/src/lib/tiposkripto/BaseGiven.js +0 -96
- package/dist/common/src/lib/tiposkripto/BaseSuite.js +0 -134
- package/dist/common/src/lib/tiposkripto/BaseThen.js +0 -65
- package/dist/common/src/lib/tiposkripto/BaseTiposkripto.js +0 -193
- package/dist/common/src/lib/tiposkripto/BaseWhen.js +0 -46
- package/dist/common/src/lib/tiposkripto/CoreTypes.js +0 -2
- package/dist/common/src/lib/tiposkripto/Node.js +0 -40
- package/dist/common/src/lib/tiposkripto/Tiposkripto.js +0 -49
- package/dist/common/src/lib/tiposkripto/Types.js +0 -2
- package/dist/common/src/lib/tiposkripto/Web.js +0 -70
- package/dist/common/src/lib/tiposkripto/abstractBase.test/MockGiven.js +0 -22
- package/dist/common/src/lib/tiposkripto/abstractBase.test/MockThen.js +0 -16
- package/dist/common/src/lib/tiposkripto/abstractBase.test/MockWhen.js +0 -18
- package/dist/common/src/lib/tiposkripto/abstractBase.test/adapter.js +0 -24
- package/dist/common/src/lib/tiposkripto/abstractBase.test/implementation.js +0 -38
- package/dist/common/src/lib/tiposkripto/abstractBase.test/index.js +0 -17
- package/dist/common/src/lib/tiposkripto/abstractBase.test/specification.js +0 -19
- package/dist/common/src/lib/tiposkripto/abstractBase.test/types.js +0 -2
- package/dist/common/src/lib/tiposkripto/index.js +0 -29
- package/dist/common/src/runtimes.js +0 -4
- package/dist/common/src/server/aider/configParser.js +0 -124
- package/dist/common/src/server/aider/docker.js +0 -30
- package/dist/common/src/server/getRunnables.js +0 -36
- package/dist/common/src/server/htmlTemplate.js +0 -44
- package/dist/common/src/server/nodeVersion.js +0 -5
- package/dist/common/src/server/runtimes/common.js +0 -136
- package/dist/common/src/server/runtimes/golang/docker.js +0 -62
- package/dist/common/src/server/runtimes/java/docker.js +0 -46
- package/dist/common/src/server/runtimes/node/docker.js +0 -42
- package/dist/common/src/server/runtimes/node/esbuild.js +0 -40
- package/dist/common/src/server/runtimes/node/node.js +0 -75
- package/dist/common/src/server/runtimes/python/docker.js +0 -31
- package/dist/common/src/server/runtimes/ruby/docker.js +0 -34
- package/dist/common/src/server/runtimes/rust/docker.js +0 -35
- package/dist/common/src/server/runtimes/web/docker.js +0 -42
- package/dist/common/src/server/runtimes/web/esbuild.js +0 -29
- package/dist/common/src/server/runtimes/web/hoist.js +0 -16
- package/dist/common/src/server/runtimes/web/web.js +0 -157
- package/dist/common/src/server/serverClasees/Server.js +0 -47
- package/dist/common/src/server/serverClasees/Server_Base.js +0 -18
- package/dist/common/src/server/serverClasees/Server_Docker.js +0 -904
- package/dist/common/src/server/serverClasees/Server_FS.js +0 -119
- package/dist/common/src/server/serverClasees/Server_HTTP.js +0 -189
- package/dist/common/src/server/serverClasees/Server_WS.js +0 -262
- package/dist/common/src/server/serverManagers/DockerManager.js +0 -28
- package/dist/common/src/server/serverManagers/HttpManager.js +0 -114
- package/dist/common/src/server/serverManagers/WsManager.js +0 -230
- package/dist/common/src/server/serverManagers/fs.js +0 -32
- package/dist/common/src/server/serverManagers/tcp.js +0 -51
- package/dist/common/src/server/types.js +0 -2
- package/dist/common/src/testeranto.js +0 -75
- package/dist/common/src/vscode/TerminalManager.js +0 -129
- package/dist/common/src/vscode/TestTreeItem.js +0 -77
- package/dist/common/src/vscode/extension.js +0 -185
- package/dist/common/src/vscode/providers/FeaturesTreeDataProvider.js +0 -445
- package/dist/common/src/vscode/providers/FileTreeDataProvider.js +0 -190
- package/dist/common/src/vscode/providers/ProcessesTreeDataProvider.js +0 -270
- package/dist/common/src/vscode/providers/ResultsTreeDataProvider.js +0 -87
- package/dist/common/src/vscode/providers/TestTreeDataProvider.js +0 -309
- package/dist/common/src/vscode/types.js +0 -9
- package/dist/common/testeranto/runtimes/node/node.js +0 -7
- package/dist/common/testeranto/runtimes/web/web.js +0 -6
- package/dist/common/testeranto/testeranto.js +0 -70
- package/dist/common/tsconfig.common.tsbuildinfo +0 -1
- package/dist/module/allTestsUtils.js +0 -13
- package/dist/module/package.json +0 -3
- package/dist/module/scripts/build-example.js +0 -100
- package/dist/module/src/Init.js +0 -33
- package/dist/module/src/Types.js +0 -62
- package/dist/module/src/esbuildConfigs/consoleDetectorPlugin.js +0 -32
- package/dist/module/src/esbuildConfigs/eslint-formatter-testeranto.js +0 -18
- package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
- package/dist/module/src/esbuildConfigs/index.js +0 -20
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -25
- package/dist/module/src/esbuildConfigs/nativeImportDetectorPlugin.js +0 -21
- package/dist/module/src/esbuildConfigs/rebuildPlugin.js +0 -14
- package/dist/module/src/init-docs.js +0 -4
- package/dist/module/src/lib/tiposkripto/BaseGiven.js +0 -92
- package/dist/module/src/lib/tiposkripto/BaseSuite.js +0 -130
- package/dist/module/src/lib/tiposkripto/BaseThen.js +0 -61
- package/dist/module/src/lib/tiposkripto/BaseTiposkripto.js +0 -190
- package/dist/module/src/lib/tiposkripto/BaseWhen.js +0 -42
- package/dist/module/src/lib/tiposkripto/CoreTypes.js +0 -1
- package/dist/module/src/lib/tiposkripto/Node.js +0 -33
- package/dist/module/src/lib/tiposkripto/Tiposkripto.js +0 -14
- package/dist/module/src/lib/tiposkripto/Types.js +0 -1
- package/dist/module/src/lib/tiposkripto/Web.js +0 -63
- package/dist/module/src/lib/tiposkripto/abstractBase.test/MockGiven.js +0 -18
- package/dist/module/src/lib/tiposkripto/abstractBase.test/MockThen.js +0 -12
- package/dist/module/src/lib/tiposkripto/abstractBase.test/MockWhen.js +0 -14
- package/dist/module/src/lib/tiposkripto/abstractBase.test/adapter.js +0 -21
- package/dist/module/src/lib/tiposkripto/abstractBase.test/implementation.js +0 -35
- package/dist/module/src/lib/tiposkripto/abstractBase.test/index.js +0 -12
- package/dist/module/src/lib/tiposkripto/abstractBase.test/specification.js +0 -15
- package/dist/module/src/lib/tiposkripto/abstractBase.test/types.js +0 -1
- package/dist/module/src/lib/tiposkripto/index.js +0 -24
- package/dist/module/src/runtimes.js +0 -1
- package/dist/module/src/server/aider/configParser.js +0 -116
- package/dist/module/src/server/aider/docker.js +0 -28
- package/dist/module/src/server/getRunnables.js +0 -29
- package/dist/module/src/server/htmlTemplate.js +0 -40
- package/dist/module/src/server/nodeVersion.js +0 -2
- package/dist/module/src/server/runtimes/common.js +0 -127
- package/dist/module/src/server/runtimes/golang/docker.js +0 -55
- package/dist/module/src/server/runtimes/java/docker.js +0 -40
- package/dist/module/src/server/runtimes/node/docker.js +0 -36
- package/dist/module/src/server/runtimes/node/esbuild.js +0 -35
- package/dist/module/src/server/runtimes/node/node.js +0 -37
- package/dist/module/src/server/runtimes/python/docker.js +0 -25
- package/dist/module/src/server/runtimes/ruby/docker.js +0 -28
- package/dist/module/src/server/runtimes/rust/docker.js +0 -29
- package/dist/module/src/server/runtimes/web/docker.js +0 -36
- package/dist/module/src/server/runtimes/web/esbuild.js +0 -24
- package/dist/module/src/server/runtimes/web/hoist.js +0 -11
- package/dist/module/src/server/runtimes/web/web.js +0 -119
- package/dist/module/src/server/serverClasees/Server.js +0 -40
- package/dist/module/src/server/serverClasees/Server_Base.js +0 -14
- package/dist/module/src/server/serverClasees/Server_Docker.js +0 -897
- package/dist/module/src/server/serverClasees/Server_FS.js +0 -119
- package/dist/module/src/server/serverClasees/Server_HTTP.js +0 -182
- package/dist/module/src/server/serverClasees/Server_WS.js +0 -258
- package/dist/module/src/server/serverManagers/DockerManager.js +0 -28
- package/dist/module/src/server/serverManagers/HttpManager.js +0 -110
- package/dist/module/src/server/serverManagers/WsManager.js +0 -226
- package/dist/module/src/server/serverManagers/fs.js +0 -32
- package/dist/module/src/server/serverManagers/tcp.js +0 -47
- package/dist/module/src/server/types.js +0 -1
- package/dist/module/src/testeranto.js +0 -40
- package/dist/module/src/vscode/TerminalManager.js +0 -92
- package/dist/module/src/vscode/TestTreeItem.js +0 -40
- package/dist/module/src/vscode/extension.js +0 -148
- package/dist/module/src/vscode/providers/FeaturesTreeDataProvider.js +0 -408
- package/dist/module/src/vscode/providers/FileTreeDataProvider.js +0 -153
- package/dist/module/src/vscode/providers/ProcessesTreeDataProvider.js +0 -233
- package/dist/module/src/vscode/providers/ResultsTreeDataProvider.js +0 -50
- package/dist/module/src/vscode/providers/TestTreeDataProvider.js +0 -272
- package/dist/module/src/vscode/types.js +0 -6
- package/dist/module/testeranto/runtimes/node/node.js +0 -5
- package/dist/module/testeranto/runtimes/web/web.js +0 -4
- package/dist/module/testeranto/testeranto.js +0 -68
- package/dist/module/tsconfig.module.tsbuildinfo +0 -1
- package/dist/prebuild/chunk-QLT7PNPK.mjs +0 -162
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +0 -20
- package/dist/prebuild/init-docs.mjs +0 -56
- package/dist/prebuild/server/runtimes/node/node.mjs +0 -80
- package/dist/prebuild/server/runtimes/web/hoist.mjs +0 -12
- package/dist/prebuild/server/runtimes/web/web.mjs +0 -162
- package/dist/prebuild/testeranto-6SAYRVSE.mjs +0 -72
- package/dist/prebuild/testeranto.mjs +0 -1692
- package/dist/types/src/Init.d.ts +0 -2
- package/dist/types/src/Types.d.ts +0 -87
- package/dist/types/src/esbuildConfigs/consoleDetectorPlugin.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/eslint-formatter-testeranto.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
- package/dist/types/src/esbuildConfigs/index.d.ts +0 -3
- package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
- package/dist/types/src/esbuildConfigs/nativeImportDetectorPlugin.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/rebuildPlugin.d.ts +0 -6
- package/dist/types/src/init-docs.d.ts +0 -1
- package/dist/types/src/lib/tiposkripto/BaseGiven.d.ts +0 -42
- package/dist/types/src/lib/tiposkripto/BaseSuite.d.ts +0 -46
- package/dist/types/src/lib/tiposkripto/BaseThen.d.ts +0 -28
- package/dist/types/src/lib/tiposkripto/BaseTiposkripto.d.ts +0 -35
- package/dist/types/src/lib/tiposkripto/BaseWhen.d.ts +0 -27
- package/dist/types/src/lib/tiposkripto/CoreTypes.d.ts +0 -51
- package/dist/types/src/lib/tiposkripto/Node.d.ts +0 -9
- package/dist/types/src/lib/tiposkripto/Tiposkripto.d.ts +0 -5
- package/dist/types/src/lib/tiposkripto/Types.d.ts +0 -9
- package/dist/types/src/lib/tiposkripto/Web.d.ts +0 -9
- package/dist/types/src/lib/tiposkripto/abstractBase.test/MockGiven.d.ts +0 -9
- package/dist/types/src/lib/tiposkripto/abstractBase.test/MockThen.d.ts +0 -6
- package/dist/types/src/lib/tiposkripto/abstractBase.test/MockWhen.d.ts +0 -6
- package/dist/types/src/lib/tiposkripto/abstractBase.test/adapter.d.ts +0 -3
- package/dist/types/src/lib/tiposkripto/abstractBase.test/implementation.d.ts +0 -3
- package/dist/types/src/lib/tiposkripto/abstractBase.test/index.d.ts +0 -28
- package/dist/types/src/lib/tiposkripto/abstractBase.test/specification.d.ts +0 -3
- package/dist/types/src/lib/tiposkripto/abstractBase.test/types.d.ts +0 -39
- package/dist/types/src/lib/tiposkripto/index.d.ts +0 -56
- package/dist/types/src/runtimes.d.ts +0 -2
- package/dist/types/src/server/aider/configParser.d.ts +0 -11
- package/dist/types/src/server/aider/docker.d.ts +0 -2
- package/dist/types/src/server/getRunnables.d.ts +0 -3
- package/dist/types/src/server/htmlTemplate.d.ts +0 -2
- package/dist/types/src/server/nodeVersion.d.ts +0 -2
- package/dist/types/src/server/runtimes/common.d.ts +0 -12
- package/dist/types/src/server/runtimes/golang/docker.d.ts +0 -5
- package/dist/types/src/server/runtimes/java/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/node/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/node/esbuild.d.ts +0 -4
- package/dist/types/src/server/runtimes/node/node.d.ts +0 -1
- package/dist/types/src/server/runtimes/python/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/ruby/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/rust/docker.d.ts +0 -14
- package/dist/types/src/server/runtimes/web/docker.d.ts +0 -15
- package/dist/types/src/server/runtimes/web/esbuild.d.ts +0 -4
- package/dist/types/src/server/runtimes/web/hoist.d.ts +0 -1
- package/dist/types/src/server/runtimes/web/web.d.ts +0 -1
- package/dist/types/src/server/serverClasees/Server.d.ts +0 -8
- package/dist/types/src/server/serverClasees/Server_Base.d.ts +0 -9
- package/dist/types/src/server/serverClasees/Server_Docker.d.ts +0 -81
- package/dist/types/src/server/serverClasees/Server_FS.d.ts +0 -0
- package/dist/types/src/server/serverClasees/Server_HTTP.d.ts +0 -20
- package/dist/types/src/server/serverClasees/Server_WS.d.ts +0 -23
- package/dist/types/src/server/serverManagers/DockerManager.d.ts +0 -0
- package/dist/types/src/server/serverManagers/HttpManager.d.ts +0 -9
- package/dist/types/src/server/serverManagers/WsManager.d.ts +0 -10
- package/dist/types/src/server/serverManagers/fs.d.ts +0 -0
- package/dist/types/src/server/serverManagers/tcp.d.ts +0 -27
- package/dist/types/src/server/types.d.ts +0 -68
- package/dist/types/src/testeranto.d.ts +0 -1
- package/dist/types/src/vscode/TerminalManager.d.ts +0 -18
- package/dist/types/src/vscode/TestTreeItem.d.ts +0 -13
- package/dist/types/src/vscode/extension.d.ts +0 -3
- package/dist/types/src/vscode/providers/FeaturesTreeDataProvider.d.ts +0 -17
- package/dist/types/src/vscode/providers/FileTreeDataProvider.d.ts +0 -13
- package/dist/types/src/vscode/providers/ProcessesTreeDataProvider.d.ts +0 -23
- package/dist/types/src/vscode/providers/ResultsTreeDataProvider.d.ts +0 -10
- package/dist/types/src/vscode/providers/TestTreeDataProvider.d.ts +0 -16
- package/dist/types/src/vscode/types.d.ts +0 -14
- package/dist/types/testeranto/testeranto.d.ts +0 -3
- package/dist/types/tsconfig.types.tsbuildinfo +0 -1
- package/dist/vscode/extension.mjs +0 -5116
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseSuite = void 0;
|
|
4
|
-
class BaseSuite {
|
|
5
|
-
addArtifact(path) {
|
|
6
|
-
if (typeof path !== "string") {
|
|
7
|
-
throw new Error(`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(path)}`);
|
|
8
|
-
}
|
|
9
|
-
const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
|
|
10
|
-
this.artifacts.push(normalizedPath);
|
|
11
|
-
}
|
|
12
|
-
constructor(name, index, givens = {}) {
|
|
13
|
-
this.artifacts = [];
|
|
14
|
-
const suiteName = name || "testSuite"; // Ensure name is never undefined
|
|
15
|
-
if (!suiteName) {
|
|
16
|
-
throw new Error("BaseSuite requires a non-empty name");
|
|
17
|
-
}
|
|
18
|
-
this.name = suiteName;
|
|
19
|
-
this.index = index;
|
|
20
|
-
this.givens = givens;
|
|
21
|
-
this.fails = 0;
|
|
22
|
-
}
|
|
23
|
-
features() {
|
|
24
|
-
try {
|
|
25
|
-
const features = Object.keys(this.givens)
|
|
26
|
-
.map((k) => this.givens[k].features)
|
|
27
|
-
.flat()
|
|
28
|
-
.filter((value, index, array) => {
|
|
29
|
-
return array.indexOf(value) === index;
|
|
30
|
-
});
|
|
31
|
-
// Convert all features to strings
|
|
32
|
-
const stringFeatures = features.map((feature) => {
|
|
33
|
-
if (typeof feature === "string") {
|
|
34
|
-
return feature;
|
|
35
|
-
}
|
|
36
|
-
else if (feature && typeof feature === "object") {
|
|
37
|
-
return feature.name || JSON.stringify(feature);
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
return String(feature);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return stringFeatures || [];
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
console.error("[ERROR] Failed to extract features:", JSON.stringify(e));
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
toObj() {
|
|
51
|
-
const givens = Object.keys(this.givens).map((k) => {
|
|
52
|
-
const givenObj = this.givens[k].toObj();
|
|
53
|
-
// Ensure given features are strings
|
|
54
|
-
// if (givenObj.features) {
|
|
55
|
-
// givenObj.features = givenObj.features.map(feature => {
|
|
56
|
-
// return feature;
|
|
57
|
-
// // if (typeof feature === 'string') {
|
|
58
|
-
// // return feature;
|
|
59
|
-
// // } else if (feature && typeof feature === 'object') {
|
|
60
|
-
// // return feature.name || JSON.stringify(feature);
|
|
61
|
-
// // } else {
|
|
62
|
-
// // return String(feature);
|
|
63
|
-
// // }
|
|
64
|
-
// });
|
|
65
|
-
// }
|
|
66
|
-
return givenObj;
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
name: this.name,
|
|
70
|
-
givens,
|
|
71
|
-
fails: this.fails,
|
|
72
|
-
failed: this.failed,
|
|
73
|
-
features: this.features(),
|
|
74
|
-
artifacts: this.artifacts
|
|
75
|
-
? this.artifacts.filter((art) => typeof art === "string")
|
|
76
|
-
: [],
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
setup(s, artifactory, tr
|
|
80
|
-
// pm: IPM
|
|
81
|
-
) {
|
|
82
|
-
console.log("mark9");
|
|
83
|
-
return new Promise((res) => res(s));
|
|
84
|
-
}
|
|
85
|
-
assertThat(t) {
|
|
86
|
-
return !!t;
|
|
87
|
-
}
|
|
88
|
-
afterAll(store, artifactory) {
|
|
89
|
-
return store;
|
|
90
|
-
}
|
|
91
|
-
async run(input, testResourceConfiguration) {
|
|
92
|
-
this.testResourceConfiguration = testResourceConfiguration;
|
|
93
|
-
const sNdx = this.index;
|
|
94
|
-
const subject = await this.setup(input,
|
|
95
|
-
// suiteArtifactory,
|
|
96
|
-
testResourceConfiguration
|
|
97
|
-
// proxiedPm
|
|
98
|
-
);
|
|
99
|
-
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
100
|
-
const giver = this.givens[gKey];
|
|
101
|
-
try {
|
|
102
|
-
this.store = await giver.give(subject, gKey, testResourceConfiguration, this.assertThat, sNdx);
|
|
103
|
-
// Add the number of failures from this given to the suite's total
|
|
104
|
-
this.fails += giver.fails || 0;
|
|
105
|
-
}
|
|
106
|
-
catch (e) {
|
|
107
|
-
this.failed = true;
|
|
108
|
-
// Add 1 to fails for the caught error
|
|
109
|
-
this.fails += 1;
|
|
110
|
-
// Also add any failures from the given itself
|
|
111
|
-
if (giver.fails) {
|
|
112
|
-
this.fails += giver.fails;
|
|
113
|
-
}
|
|
114
|
-
console.error(`Error in given ${gKey}:`, e);
|
|
115
|
-
// Don't re-throw to continue with other givens
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// Mark the suite as failed if there are any failures
|
|
119
|
-
if (this.fails > 0) {
|
|
120
|
-
this.failed = true;
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
// Ensure addArtifact is properly bound to 'this'
|
|
124
|
-
this.afterAll(this.store);
|
|
125
|
-
}
|
|
126
|
-
catch (e) {
|
|
127
|
-
console.error(JSON.stringify(e));
|
|
128
|
-
// this.fails.push(this);
|
|
129
|
-
// return this;
|
|
130
|
-
}
|
|
131
|
-
return this;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.BaseSuite = BaseSuite;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseThen = void 0;
|
|
4
|
-
class BaseThen {
|
|
5
|
-
constructor(name, thenCB) {
|
|
6
|
-
this.artifacts = [];
|
|
7
|
-
this.name = name;
|
|
8
|
-
this.thenCB = thenCB;
|
|
9
|
-
this.error = false;
|
|
10
|
-
this.artifacts = [];
|
|
11
|
-
}
|
|
12
|
-
addArtifact(path) {
|
|
13
|
-
if (typeof path !== "string") {
|
|
14
|
-
throw new Error(`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(path)}`);
|
|
15
|
-
}
|
|
16
|
-
const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
|
|
17
|
-
this.artifacts.push(normalizedPath);
|
|
18
|
-
}
|
|
19
|
-
toObj() {
|
|
20
|
-
const obj = {
|
|
21
|
-
name: this.name,
|
|
22
|
-
error: this.error,
|
|
23
|
-
artifacts: this.artifacts,
|
|
24
|
-
status: this.status,
|
|
25
|
-
};
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
async test(store, testResourceConfiguration,
|
|
29
|
-
// tLog: ITLog,
|
|
30
|
-
// pm: IPM,
|
|
31
|
-
filepath) {
|
|
32
|
-
// Ensure addArtifact is properly bound to 'this'
|
|
33
|
-
const addArtifact = this.addArtifact.bind(this);
|
|
34
|
-
// const proxiedPm = butThenProxy(pm, filepath, addArtifact);
|
|
35
|
-
try {
|
|
36
|
-
const x = await this.butThen(store, async (s) => {
|
|
37
|
-
try {
|
|
38
|
-
if (typeof this.thenCB === "function") {
|
|
39
|
-
const result = await this.thenCB(s);
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
return this.thenCB;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
// Mark this then step as failed
|
|
48
|
-
this.error = true;
|
|
49
|
-
// Re-throw to be caught by the outer catch block
|
|
50
|
-
throw e;
|
|
51
|
-
}
|
|
52
|
-
}, testResourceConfiguration
|
|
53
|
-
// proxiedPm
|
|
54
|
-
);
|
|
55
|
-
this.status = true;
|
|
56
|
-
return x;
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
this.status = false;
|
|
60
|
-
this.error = true;
|
|
61
|
-
throw e;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.BaseThen = BaseThen;
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BaseGiven_1 = require("./BaseGiven");
|
|
4
|
-
const BaseSuite_1 = require("./BaseSuite");
|
|
5
|
-
const BaseThen_js_1 = require("./BaseThen.js");
|
|
6
|
-
const BaseWhen_js_1 = require("./BaseWhen.js");
|
|
7
|
-
const index_js_1 = require("./index.js");
|
|
8
|
-
class BaseTiposkripto {
|
|
9
|
-
constructor(webOrNode, input, testSpecification, testImplementation, testResourceRequirement = index_js_1.defaultTestResourceRequirement, testAdapter = {}, testResourceConfiguration, wsPort = "3456", wsHost = "localhost") {
|
|
10
|
-
this.totalTests = 0;
|
|
11
|
-
this.artifacts = [];
|
|
12
|
-
this.testResourceConfiguration = testResourceConfiguration;
|
|
13
|
-
const fullAdapter = (0, index_js_1.DefaultAdapter)(testAdapter);
|
|
14
|
-
if (!testImplementation.suites ||
|
|
15
|
-
typeof testImplementation.suites !== "object") {
|
|
16
|
-
throw new Error(`testImplementation.suites must be an object, got ${typeof testImplementation.suites}: ${JSON.stringify(testImplementation.suites)}`);
|
|
17
|
-
}
|
|
18
|
-
const classySuites = Object.entries(testImplementation.suites).reduce((a, [key], index) => {
|
|
19
|
-
a[key] = (somestring, givens) => {
|
|
20
|
-
return new (class extends BaseSuite_1.BaseSuite {
|
|
21
|
-
afterAll(store) {
|
|
22
|
-
return fullAdapter.afterAll(store);
|
|
23
|
-
}
|
|
24
|
-
assertThat(t) {
|
|
25
|
-
return fullAdapter.assertThis(t);
|
|
26
|
-
}
|
|
27
|
-
async setup(s, tr) {
|
|
28
|
-
var _a, _b;
|
|
29
|
-
return ((_b = (_a = fullAdapter.beforeAll) === null || _a === void 0 ? void 0 : _a.call(fullAdapter, s, tr)) !== null && _b !== void 0 ? _b : s);
|
|
30
|
-
}
|
|
31
|
-
})(somestring, index, givens);
|
|
32
|
-
};
|
|
33
|
-
return a;
|
|
34
|
-
}, {});
|
|
35
|
-
const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, g]) => {
|
|
36
|
-
a[key] = (features, whens, thens, gcb, initialValues) => {
|
|
37
|
-
// WTF
|
|
38
|
-
// Ensure parameters are arrays and create copies to avoid reference issues
|
|
39
|
-
const safeFeatures = Array.isArray(features) ? [...features] : [];
|
|
40
|
-
const safeWhens = Array.isArray(whens) ? [...whens] : [];
|
|
41
|
-
const safeThens = Array.isArray(thens) ? [...thens] : [];
|
|
42
|
-
return new (class extends BaseGiven_1.BaseGiven {
|
|
43
|
-
async givenThat(subject, testResource, initializer, initialValues) {
|
|
44
|
-
return fullAdapter.beforeEach(subject, initializer, testResource, initialValues);
|
|
45
|
-
}
|
|
46
|
-
afterEach(store, key) {
|
|
47
|
-
return Promise.resolve(fullAdapter.afterEach(store, key));
|
|
48
|
-
}
|
|
49
|
-
})(safeFeatures, safeWhens, safeThens, testImplementation.givens[key], initialValues);
|
|
50
|
-
};
|
|
51
|
-
return a;
|
|
52
|
-
}, {});
|
|
53
|
-
const classyWhens = Object.entries(testImplementation.whens).reduce((a, [key, whEn]) => {
|
|
54
|
-
a[key] = (...payload) => {
|
|
55
|
-
const whenInstance = new (class extends BaseWhen_js_1.BaseWhen {
|
|
56
|
-
async andWhen(store, whenCB, testResource) {
|
|
57
|
-
return await fullAdapter.andWhen(store, whenCB, testResource);
|
|
58
|
-
}
|
|
59
|
-
})(`${key}: ${payload && payload.toString()}`, whEn(...payload));
|
|
60
|
-
return whenInstance;
|
|
61
|
-
};
|
|
62
|
-
return a;
|
|
63
|
-
}, {});
|
|
64
|
-
const classyThens = Object.entries(testImplementation.thens).reduce((a, [key, thEn]) => {
|
|
65
|
-
a[key] = (...args) => {
|
|
66
|
-
const thenInstance = new (class extends BaseThen_js_1.BaseThen {
|
|
67
|
-
async butThen(store, thenCB, testResource) {
|
|
68
|
-
return await fullAdapter.butThen(store, thenCB, testResource);
|
|
69
|
-
}
|
|
70
|
-
})(`${key}: ${args && args.toString()}`, thEn(...args));
|
|
71
|
-
return thenInstance;
|
|
72
|
-
};
|
|
73
|
-
return a;
|
|
74
|
-
}, {});
|
|
75
|
-
this.suitesOverrides = classySuites;
|
|
76
|
-
this.givenOverrides = classyGivens;
|
|
77
|
-
this.whenOverrides = classyWhens;
|
|
78
|
-
this.thenOverrides = classyThens;
|
|
79
|
-
this.testResourceRequirement = testResourceRequirement;
|
|
80
|
-
this.testSpecification = testSpecification;
|
|
81
|
-
this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then());
|
|
82
|
-
this.totalTests = this.calculateTotalTests();
|
|
83
|
-
this.testJobs = this.specs.map((suite) => {
|
|
84
|
-
const suiteRunner = (suite) => async (testResourceConfiguration) => {
|
|
85
|
-
try {
|
|
86
|
-
const x = await suite.run(input, testResourceConfiguration || {
|
|
87
|
-
name: suite.name,
|
|
88
|
-
fs: process.cwd(),
|
|
89
|
-
ports: [],
|
|
90
|
-
timeout: 30000,
|
|
91
|
-
retries: 3,
|
|
92
|
-
environment: {},
|
|
93
|
-
});
|
|
94
|
-
return x;
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
console.error(e.stack);
|
|
98
|
-
throw e;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
const runner = suiteRunner(suite);
|
|
102
|
-
const totalTests = this.totalTests;
|
|
103
|
-
const testJob = {
|
|
104
|
-
test: suite,
|
|
105
|
-
toObj: () => {
|
|
106
|
-
return suite.toObj();
|
|
107
|
-
},
|
|
108
|
-
runner,
|
|
109
|
-
receiveTestResourceConfig: async (testResourceConfiguration) => {
|
|
110
|
-
try {
|
|
111
|
-
const suiteDone = await runner(testResourceConfiguration);
|
|
112
|
-
const fails = suiteDone.fails;
|
|
113
|
-
return {
|
|
114
|
-
failed: fails > 0,
|
|
115
|
-
fails,
|
|
116
|
-
artifacts: [], // this.artifacts is not accessible here
|
|
117
|
-
features: suiteDone.features(),
|
|
118
|
-
tests: 0,
|
|
119
|
-
runTimeTests: totalTests,
|
|
120
|
-
testJob: testJob.toObj(),
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
catch (e) {
|
|
124
|
-
console.error(e.stack);
|
|
125
|
-
return {
|
|
126
|
-
failed: true,
|
|
127
|
-
fails: -1,
|
|
128
|
-
artifacts: [],
|
|
129
|
-
features: [],
|
|
130
|
-
tests: 0,
|
|
131
|
-
runTimeTests: -1,
|
|
132
|
-
testJob: testJob.toObj(),
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
return testJob;
|
|
138
|
-
});
|
|
139
|
-
this.testJobs[0].receiveTestResourceConfig(testResourceConfiguration).then((results) => {
|
|
140
|
-
// The actual path is determined by the concrete implementation (Node.ts or Web.ts)
|
|
141
|
-
// They will write to the correct pattern: testeranto/reports/allTests/example/${runtime}.Calculator.test.ts.json
|
|
142
|
-
// We just pass a placeholder filename webOrNode
|
|
143
|
-
this.writeFileSync(`testeranto/reports/allTests/example/${webOrNode}/Calculator.test.ts.json`, JSON.stringify(results));
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
async receiveTestResourceConfig(testResourceConfig) {
|
|
147
|
-
if (this.testJobs && this.testJobs.length > 0) {
|
|
148
|
-
return this.testJobs[0].receiveTestResourceConfig(testResourceConfig);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
throw new Error("No test jobs available");
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
Specs() {
|
|
155
|
-
return this.specs;
|
|
156
|
-
}
|
|
157
|
-
Suites() {
|
|
158
|
-
if (!this.suitesOverrides) {
|
|
159
|
-
throw new Error(`suitesOverrides is undefined. classySuites: ${JSON.stringify(Object.keys(this.suitesOverrides || {}))}`);
|
|
160
|
-
}
|
|
161
|
-
return this.suitesOverrides;
|
|
162
|
-
}
|
|
163
|
-
Given() {
|
|
164
|
-
return this.givenOverrides;
|
|
165
|
-
}
|
|
166
|
-
When() {
|
|
167
|
-
return this.whenOverrides;
|
|
168
|
-
}
|
|
169
|
-
Then() {
|
|
170
|
-
return this.thenOverrides;
|
|
171
|
-
}
|
|
172
|
-
// Add a method to access test jobs which can be used by receiveTestResourceConfig
|
|
173
|
-
getTestJobs() {
|
|
174
|
-
return this.testJobs;
|
|
175
|
-
}
|
|
176
|
-
calculateTotalTests() {
|
|
177
|
-
let total = 0;
|
|
178
|
-
for (const suite of this.specs) {
|
|
179
|
-
if (suite && typeof suite === "object") {
|
|
180
|
-
// Access the givens property which should be a record of test names to BaseGiven instances
|
|
181
|
-
// The givens property is typically on the suite instance
|
|
182
|
-
if ("givens" in suite) {
|
|
183
|
-
const givens = suite.givens;
|
|
184
|
-
if (givens && typeof givens === "object") {
|
|
185
|
-
total += Object.keys(givens).length;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return total;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
exports.default = BaseTiposkripto;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseWhen = void 0;
|
|
4
|
-
class BaseWhen {
|
|
5
|
-
addArtifact(path) {
|
|
6
|
-
if (typeof path !== "string") {
|
|
7
|
-
throw new Error(`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(path)}`);
|
|
8
|
-
}
|
|
9
|
-
const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
|
|
10
|
-
this.artifacts.push(normalizedPath);
|
|
11
|
-
}
|
|
12
|
-
constructor(name, whenCB) {
|
|
13
|
-
this.artifacts = [];
|
|
14
|
-
this.name = name;
|
|
15
|
-
this.whenCB = whenCB;
|
|
16
|
-
}
|
|
17
|
-
toObj() {
|
|
18
|
-
const obj = {
|
|
19
|
-
name: this.name,
|
|
20
|
-
status: this.status,
|
|
21
|
-
error: this.error
|
|
22
|
-
? `${this.error.name}: ${this.error.message}\n${this.error.stack}`
|
|
23
|
-
: null,
|
|
24
|
-
artifacts: this.artifacts,
|
|
25
|
-
};
|
|
26
|
-
return obj;
|
|
27
|
-
}
|
|
28
|
-
async test(store, testResourceConfiguration) {
|
|
29
|
-
try {
|
|
30
|
-
// Ensure addArtifact is properly bound to 'this'
|
|
31
|
-
// const addArtifact = this.addArtifact.bind(this);
|
|
32
|
-
// const proxiedPm = andWhenProxy(pm, filepath, addArtifact);
|
|
33
|
-
const result = await this.andWhen(store, this.whenCB, testResourceConfiguration
|
|
34
|
-
// proxiedPm
|
|
35
|
-
);
|
|
36
|
-
this.status = true;
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
this.status = false;
|
|
41
|
-
this.error = e;
|
|
42
|
-
throw e;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.BaseWhen = BaseWhen;
|
|
@@ -1,40 +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
|
-
exports.NodeTiposkripto = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const BaseTiposkripto_js_1 = __importDefault(require("./BaseTiposkripto.js"));
|
|
9
|
-
const index_js_1 = require("./index.js");
|
|
10
|
-
console.log(`[NodeTiposkripto] ${process.argv}`);
|
|
11
|
-
const config = { ports: [1111], fs: 'testeranto/reports/allTests/example/Calculator.test/node' };
|
|
12
|
-
class NodeTiposkripto extends BaseTiposkripto_js_1.default {
|
|
13
|
-
constructor(input, testSpecification, testImplementation, testResourceRequirement, testAdapter) {
|
|
14
|
-
// console.log(`[NodeTiposkripto] constructor ${process.argv[3]}`);
|
|
15
|
-
// const config = JSON.parse(process.argv[3])
|
|
16
|
-
super("node", input, testSpecification, testImplementation, testResourceRequirement, testAdapter, config);
|
|
17
|
-
}
|
|
18
|
-
writeFileSync(filename, payload) {
|
|
19
|
-
console.log('writeFileSync', filename);
|
|
20
|
-
const dir = "testeranto/reports/allTests/example";
|
|
21
|
-
if (!fs_1.default.existsSync(dir)) {
|
|
22
|
-
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
23
|
-
}
|
|
24
|
-
// Write to the exact filename provided
|
|
25
|
-
fs_1.default.writeFileSync(filename, payload);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.NodeTiposkripto = NodeTiposkripto;
|
|
29
|
-
const tiposkripto = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
|
|
30
|
-
try {
|
|
31
|
-
const t = new NodeTiposkripto(input, testSpecification, testImplementation, testResourceRequirement, testAdapter);
|
|
32
|
-
return t;
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
console.error(`[Node] Error creating Tiposkripto:`, e);
|
|
36
|
-
console.error(e.stack);
|
|
37
|
-
process.exit(-1);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
exports.default = tiposkripto;
|
|
@@ -1,49 +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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const _1 = require(".");
|
|
37
|
-
let tpskrt;
|
|
38
|
-
if (ENV === "node") {
|
|
39
|
-
tpskrt = await Promise.resolve().then(() => __importStar(require("./Node")));
|
|
40
|
-
}
|
|
41
|
-
else if (ENV === "web") {
|
|
42
|
-
tpskrt = await Promise.resolve().then(() => __importStar(require("./Web")));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
throw `Unknown ENV ${ENV}`;
|
|
46
|
-
}
|
|
47
|
-
exports.default = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = _1.defaultTestResourceRequirement, testResourceConfiguration) => {
|
|
48
|
-
return (await tpskrt.default)(input, testSpecification, testImplementation, testResourceRequirement, testAdapter, testResourceConfiguration);
|
|
49
|
-
};
|
|
@@ -1,70 +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
|
-
exports.WebTiposkripto = void 0;
|
|
7
|
-
const BaseTiposkripto_js_1 = __importDefault(require("./BaseTiposkripto.js"));
|
|
8
|
-
const index_js_1 = require("./index.js");
|
|
9
|
-
const config = {
|
|
10
|
-
name: 'web',
|
|
11
|
-
fs: 'testeranto/reports/allTests/example/Calculator.test/web',
|
|
12
|
-
ports: [1111],
|
|
13
|
-
files: [],
|
|
14
|
-
timeout: 30000,
|
|
15
|
-
retries: 3,
|
|
16
|
-
environment: {}
|
|
17
|
-
};
|
|
18
|
-
class WebTiposkripto extends BaseTiposkripto_js_1.default {
|
|
19
|
-
constructor(input, testSpecification, testImplementation, testResourceRequirement, testAdapter) {
|
|
20
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
21
|
-
const encodedConfig = urlParams.get("config");
|
|
22
|
-
const testResourceConfig = encodedConfig
|
|
23
|
-
? decodeURIComponent(encodedConfig)
|
|
24
|
-
: "{}";
|
|
25
|
-
super("web", input, testSpecification, testImplementation, testResourceRequirement, testAdapter,
|
|
26
|
-
// JSON.parse(testResourceConfig)
|
|
27
|
-
config);
|
|
28
|
-
}
|
|
29
|
-
writeFileSync(filename, payload) {
|
|
30
|
-
// Store files in a global object that can be accessed via Puppeteer
|
|
31
|
-
if (!window.__testeranto_files__) {
|
|
32
|
-
window.__testeranto_files__ = {};
|
|
33
|
-
}
|
|
34
|
-
window.__testeranto_files__[filename] = payload;
|
|
35
|
-
// Also try to use the File System Access API if available
|
|
36
|
-
if (navigator.storage && navigator.storage.getDirectory) {
|
|
37
|
-
(async () => {
|
|
38
|
-
try {
|
|
39
|
-
const root = await navigator.storage.getDirectory();
|
|
40
|
-
const fileHandle = await root.getFileHandle(filename, { create: true });
|
|
41
|
-
const writable = await fileHandle.createWritable();
|
|
42
|
-
await writable.write(payload);
|
|
43
|
-
await writable.close();
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
console.warn('Could not write to browser storage:', e);
|
|
47
|
-
}
|
|
48
|
-
})();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.WebTiposkripto = WebTiposkripto;
|
|
53
|
-
const tiposkripto = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
|
|
54
|
-
try {
|
|
55
|
-
const t = new WebTiposkripto(input, testSpecification, testImplementation, testResourceRequirement, testAdapter);
|
|
56
|
-
// const data = navigator.storage.
|
|
57
|
-
const root = await navigator.storage.getDirectory();
|
|
58
|
-
// 1. Create (or get) a file handle
|
|
59
|
-
const fileHandle = await root.getFileHandle(`${config.fs}/tests.json`);
|
|
60
|
-
return t;
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
console.error(e);
|
|
64
|
-
// Dispatch an error event
|
|
65
|
-
const errorEvent = new CustomEvent("test-error", { detail: e });
|
|
66
|
-
window.dispatchEvent(errorEvent);
|
|
67
|
-
throw e;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
exports.default = tiposkripto;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockGiven = void 0;
|
|
4
|
-
const BaseGiven_1 = require("../BaseGiven");
|
|
5
|
-
class MockGiven extends BaseGiven_1.BaseGiven {
|
|
6
|
-
constructor(name, features, whens, thens, givenCB, initialValues) {
|
|
7
|
-
super(name, features, whens, thens, givenCB, initialValues);
|
|
8
|
-
}
|
|
9
|
-
async givenThat(subject, testResourceConfiguration, artifactory, givenCB, initialValues) {
|
|
10
|
-
// Call the givenCB which is a function that returns the store
|
|
11
|
-
const result = givenCB();
|
|
12
|
-
if (typeof result === "function") {
|
|
13
|
-
return result();
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
uberCatcher(e) {
|
|
18
|
-
console.error("MockGiven error:", e);
|
|
19
|
-
this.error = e;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.MockGiven = MockGiven;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockThen = void 0;
|
|
4
|
-
const BaseThen_1 = require("../BaseThen");
|
|
5
|
-
class MockThen extends BaseThen_1.BaseThen {
|
|
6
|
-
constructor(name, thenCB) {
|
|
7
|
-
super(name, thenCB);
|
|
8
|
-
}
|
|
9
|
-
async butThen(store, thenCB, testResourceConfiguration) {
|
|
10
|
-
// The thenCB expects a selection, not the store directly
|
|
11
|
-
// We need to extract the selection from the store
|
|
12
|
-
const selection = { testSelection: store.testSelection };
|
|
13
|
-
return thenCB(selection);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.MockThen = MockThen;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MockWhen = void 0;
|
|
4
|
-
const BaseWhen_1 = require("../BaseWhen");
|
|
5
|
-
class MockWhen extends BaseWhen_1.BaseWhen {
|
|
6
|
-
constructor(name, whenCB) {
|
|
7
|
-
super(name, whenCB);
|
|
8
|
-
}
|
|
9
|
-
async andWhen(store, whenCB, testResource) {
|
|
10
|
-
// The whenCB returns a function that takes the store
|
|
11
|
-
const result = whenCB(store);
|
|
12
|
-
if (typeof result === "function") {
|
|
13
|
-
return result(store);
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.MockWhen = MockWhen;
|