testeranto 0.47.11 → 0.47.13
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/Features.js +85 -0
- package/dist/common/Node.js +82 -0
- package/dist/common/NodeWriter.js +56 -0
- package/dist/common/Project.js +648 -0
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +70 -0
- package/dist/common/core.js +392 -0
- package/dist/common/electron.js +40 -0
- package/dist/common/preload.js +8 -0
- package/dist/common/subPackages/react/component.js +2 -0
- package/dist/common/subPackages/react/node.js +57 -0
- package/dist/common/subPackages/react/web.js +57 -0
- package/dist/common/subPackages/react-test-render/component.js +2 -0
- package/dist/common/subPackages/react-test-render/node.js +46 -0
- package/dist/common/subPackages/react-test-render/web.js +46 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -0
- package/dist/module/Features.js +74 -0
- package/dist/module/Node.js +77 -0
- package/dist/module/NodeWriter.js +50 -0
- package/dist/module/Project.js +618 -0
- package/dist/module/Report.js +186 -0
- package/dist/module/Types.js +1 -0
- package/dist/module/Web.js +65 -0
- package/dist/module/core.js +383 -0
- package/dist/module/electron.js +35 -0
- package/dist/module/preload.js +6 -0
- package/dist/module/subPackages/react/component.js +1 -0
- package/dist/module/subPackages/react/node.js +52 -0
- package/dist/module/subPackages/react/web.js +52 -0
- package/dist/module/subPackages/react-test-render/component.js +1 -0
- package/dist/module/subPackages/react-test-render/node.js +16 -0
- package/dist/module/subPackages/react-test-render/web.js +16 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -0
- package/dist/types/Features.d.ts +68 -0
- package/dist/types/Node.d.ts +12 -0
- package/dist/types/NodeWriter.d.ts +2 -0
- package/dist/types/Project.d.ts +32 -0
- package/dist/types/Types.d.ts +17 -0
- package/dist/types/Web.d.ts +12 -0
- package/dist/types/core.d.ts +219 -0
- package/dist/types/electron.d.ts +1 -0
- package/dist/types/preload.d.ts +1 -0
- package/dist/types/subPackages/react/component.d.ts +17 -0
- package/dist/types/subPackages/react/node.d.ts +4 -0
- package/dist/types/subPackages/react/web.d.ts +4 -0
- package/dist/types/subPackages/react-test-render/component.d.ts +17 -0
- package/dist/types/subPackages/react-test-render/node.d.ts +4 -0
- package/dist/types/subPackages/react-test-render/web.d.ts +4 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/package.json +9 -5
- package/src/subPackages/react/component.ts +1 -0
- package/src/subPackages/react-test-render/component.ts +21 -0
|
@@ -0,0 +1,85 @@
|
|
|
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.DirectedGraph = exports.TesterantoFeatures = exports.TesterantoGraphDirectedAcyclic = exports.TesterantoGraphDirected = exports.TesterantoGraphUndirected = exports.BaseFeature = void 0;
|
|
7
|
+
const graphology_1 = __importDefault(require("graphology"));
|
|
8
|
+
/* @ts-ignore:next-line */
|
|
9
|
+
const { DirectedGraph, UndirectedGraph } = graphology_1.default;
|
|
10
|
+
exports.DirectedGraph = DirectedGraph;
|
|
11
|
+
class TesterantoGraph {
|
|
12
|
+
constructor(name) {
|
|
13
|
+
this.name = name;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class BaseFeature {
|
|
17
|
+
constructor(name) {
|
|
18
|
+
this.name = name;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.BaseFeature = BaseFeature;
|
|
22
|
+
class TesterantoGraphUndirected {
|
|
23
|
+
constructor(name) {
|
|
24
|
+
this.name = name;
|
|
25
|
+
this.graph = new UndirectedGraph();
|
|
26
|
+
}
|
|
27
|
+
connect(a, b, relation) {
|
|
28
|
+
this.graph.mergeEdge(a, b, { type: relation });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.TesterantoGraphUndirected = TesterantoGraphUndirected;
|
|
32
|
+
class TesterantoGraphDirected {
|
|
33
|
+
constructor(name) {
|
|
34
|
+
this.name = name;
|
|
35
|
+
this.graph = new DirectedGraph();
|
|
36
|
+
}
|
|
37
|
+
connect(to, from, relation) {
|
|
38
|
+
this.graph.mergeEdge(to, from, { type: relation });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.TesterantoGraphDirected = TesterantoGraphDirected;
|
|
42
|
+
class TesterantoGraphDirectedAcyclic {
|
|
43
|
+
constructor(name) {
|
|
44
|
+
this.name = name;
|
|
45
|
+
this.graph = new DirectedGraph();
|
|
46
|
+
}
|
|
47
|
+
connect(to, from, relation) {
|
|
48
|
+
this.graph.mergeEdge(to, from, { type: relation });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.TesterantoGraphDirectedAcyclic = TesterantoGraphDirectedAcyclic;
|
|
52
|
+
class TesterantoFeatures {
|
|
53
|
+
constructor(features, graphs) {
|
|
54
|
+
this.features = features;
|
|
55
|
+
this.graphs = graphs;
|
|
56
|
+
}
|
|
57
|
+
networks() {
|
|
58
|
+
return [
|
|
59
|
+
...this.graphs.undirected.values(),
|
|
60
|
+
...this.graphs.directed.values(),
|
|
61
|
+
...this.graphs.dags.values(),
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
toObj() {
|
|
65
|
+
return {
|
|
66
|
+
features: Object.entries(this.features).map(([name, feature]) => {
|
|
67
|
+
return Object.assign(Object.assign({}, feature), { inNetworks: this.networks()
|
|
68
|
+
.filter((network) => {
|
|
69
|
+
return network.graph.hasNode(feature.name);
|
|
70
|
+
})
|
|
71
|
+
.map((network) => {
|
|
72
|
+
return {
|
|
73
|
+
network: network.name,
|
|
74
|
+
neighbors: network.graph.neighbors(feature.name),
|
|
75
|
+
};
|
|
76
|
+
}) });
|
|
77
|
+
}),
|
|
78
|
+
networks: this.networks().map((network) => {
|
|
79
|
+
return Object.assign({}, network);
|
|
80
|
+
}),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.TesterantoFeatures = TesterantoFeatures;
|
|
85
|
+
exports.default = {};
|
|
@@ -0,0 +1,82 @@
|
|
|
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 core_js_1 = require("./core.js");
|
|
7
|
+
const core_js_2 = __importDefault(require("./core.js"));
|
|
8
|
+
const NodeWriter_js_1 = require("./NodeWriter.js");
|
|
9
|
+
const receiveTestResourceConfig = async (t, testresource) => {
|
|
10
|
+
const { failed, artifacts, logPromise } = await t.receiveTestResourceConfig(testresource);
|
|
11
|
+
/* @ts-ignore:next-line */
|
|
12
|
+
process.send({
|
|
13
|
+
type: "testeranto:adios",
|
|
14
|
+
data: {
|
|
15
|
+
failed,
|
|
16
|
+
testResourceConfiguration: t.test.testResourceConfiguration,
|
|
17
|
+
results: t.toObj(),
|
|
18
|
+
},
|
|
19
|
+
}, async (err) => {
|
|
20
|
+
if (!err) {
|
|
21
|
+
Promise.all([...artifacts, logPromise]).then(async () => {
|
|
22
|
+
process.exit(await failed ? 1 : 0);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
console.error(err);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = core_js_1.defaultTestResourceRequirement) => {
|
|
32
|
+
const mrt = new core_js_2.default(input, testSpecification, testImplementation, testInterface, testResourceRequirement, testInterface.assertioner || (async (t) => t), testInterface.beforeEach || async function (subject, initialValues, testResource) {
|
|
33
|
+
return subject;
|
|
34
|
+
}, testInterface.afterEach || (async (s) => s), testInterface.afterAll || ((store) => undefined), testInterface.butThen || (async (a) => a), testInterface.andWhen, testInterface.actionHandler ||
|
|
35
|
+
function (b) {
|
|
36
|
+
return b;
|
|
37
|
+
}, NodeWriter_js_1.NodeWriter);
|
|
38
|
+
const tl2 = mrt;
|
|
39
|
+
const t = tl2.testJobs[0];
|
|
40
|
+
const testResourceArg = process.argv[2] || `{}`;
|
|
41
|
+
try {
|
|
42
|
+
const partialTestResource = JSON.parse(testResourceArg);
|
|
43
|
+
if (testResourceRequirement.ports == 0) {
|
|
44
|
+
receiveTestResourceConfig(t, partialTestResource);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.log("test configuration is incomplete", partialTestResource);
|
|
48
|
+
console.log("requesting test resources via IPC ...", testResourceRequirement);
|
|
49
|
+
/* @ts-ignore:next-line */
|
|
50
|
+
process.send({
|
|
51
|
+
type: "testeranto:hola",
|
|
52
|
+
data: {
|
|
53
|
+
requirement: Object.assign(Object.assign({}, testResourceRequirement), { name: partialTestResource.name })
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
console.log("awaiting test resources via IPC...");
|
|
57
|
+
process.on("message", async function (packet) {
|
|
58
|
+
console.log("message: ", packet);
|
|
59
|
+
const resourcesFromPm2 = packet.data.testResourceConfiguration;
|
|
60
|
+
const secondTestResource = Object.assign(Object.assign({ fs: "." }, JSON.parse(JSON.stringify(partialTestResource))), JSON.parse(JSON.stringify(resourcesFromPm2)));
|
|
61
|
+
console.log("secondTestResource", secondTestResource);
|
|
62
|
+
receiveTestResourceConfig(t, secondTestResource);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
console.error(e);
|
|
68
|
+
process.exit(-1);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
// else {
|
|
72
|
+
// console.log("Pass run-time test resources by STDIN", process.stdin);
|
|
73
|
+
// process.stdin.on("data", async (data) => {
|
|
74
|
+
// console.log("data: ", data);
|
|
75
|
+
// const resourcesFromStdin = JSON.parse(data.toString());
|
|
76
|
+
// const secondTestResource = {
|
|
77
|
+
// ...JSON.parse(JSON.stringify(resourcesFromStdin)),
|
|
78
|
+
// ...JSON.parse(JSON.stringify(partialTestResource)),
|
|
79
|
+
// } as ITTestResourceConfiguration;
|
|
80
|
+
// await t.receiveTestResourceConfig(secondTestResource);
|
|
81
|
+
// });
|
|
82
|
+
// }
|
|
@@ -0,0 +1,56 @@
|
|
|
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.NodeWriter = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fPaths = [];
|
|
10
|
+
exports.NodeWriter = {
|
|
11
|
+
createWriteStream: (filepath) => {
|
|
12
|
+
return fs_1.default.createWriteStream(filepath);
|
|
13
|
+
},
|
|
14
|
+
writeFileSync: (fp, contents) => {
|
|
15
|
+
fs_1.default.writeFileSync(fp, contents);
|
|
16
|
+
},
|
|
17
|
+
mkdirSync: async (fp) => {
|
|
18
|
+
await fs_1.default.mkdirSync(fp, { recursive: true });
|
|
19
|
+
},
|
|
20
|
+
testArtiFactoryfileWriter: (tLog, callback) => (fPath, value) => {
|
|
21
|
+
callback(new Promise((res, rej) => {
|
|
22
|
+
tLog("testArtiFactory =>", fPath);
|
|
23
|
+
const cleanPath = path_1.default.resolve(fPath);
|
|
24
|
+
fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
25
|
+
const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
26
|
+
fs_1.default.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
27
|
+
if (error) {
|
|
28
|
+
console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
29
|
+
}
|
|
30
|
+
fs_1.default.writeFileSync(path_1.default.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
|
|
31
|
+
encoding: "utf-8",
|
|
32
|
+
});
|
|
33
|
+
if (Buffer.isBuffer(value)) {
|
|
34
|
+
fs_1.default.writeFileSync(fPath, value, "binary");
|
|
35
|
+
res();
|
|
36
|
+
}
|
|
37
|
+
else if (`string` === typeof value) {
|
|
38
|
+
fs_1.default.writeFileSync(fPath, value.toString(), {
|
|
39
|
+
encoding: "utf-8",
|
|
40
|
+
});
|
|
41
|
+
res();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
/* @ts-ignore:next-line */
|
|
45
|
+
const pipeStream = value;
|
|
46
|
+
const myFile = fs_1.default.createWriteStream(fPath);
|
|
47
|
+
pipeStream.pipe(myFile);
|
|
48
|
+
pipeStream.on("close", () => {
|
|
49
|
+
myFile.close();
|
|
50
|
+
res();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
};
|