worker-testbed 1.0.9 → 1.0.11
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/build/index.cjs +15 -8
- package/build/index.mjs +16 -9
- package/package.json +67 -67
package/build/index.cjs
CHANGED
|
@@ -77,14 +77,21 @@ const run = functoolsKit.singleshot(async (__filename, cb = () => { }) => {
|
|
|
77
77
|
if (!worker_threads.parentPort) {
|
|
78
78
|
throw new Error("workertest parentPort is null");
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
80
|
+
const finishTest = functoolsKit.singleshot((status, msg) => {
|
|
81
|
+
worker_threads.parentPort.postMessage({ status, msg });
|
|
82
|
+
process.exit(0);
|
|
83
|
+
});
|
|
84
|
+
process.on('uncaughtException', function (err) {
|
|
85
|
+
// fail current test in worker
|
|
86
|
+
finishTest("fail", `Uncaught exception: ${functoolsKit.getErrorMessage(err)}`);
|
|
87
|
+
});
|
|
88
|
+
process.on('unhandledRejection', (error) => {
|
|
89
|
+
throw error;
|
|
90
|
+
});
|
|
91
|
+
testRegistry.get(worker_threads.workerData.testName).cb({
|
|
92
|
+
pass: (msg) => finishTest("pass", msg),
|
|
93
|
+
fail: (msg) => finishTest("fail", msg),
|
|
94
|
+
});
|
|
88
95
|
});
|
|
89
96
|
|
|
90
97
|
exports.run = run;
|
package/build/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isMainThread, parentPort, workerData, Worker } from 'worker_threads';
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
|
-
import { BehaviorSubject, Subject, ToolRegistry, singleshot,
|
|
3
|
+
import { BehaviorSubject, Subject, ToolRegistry, singleshot, getErrorMessage, createAwaiter } from 'functools-kit';
|
|
4
4
|
import tape from 'tape';
|
|
5
5
|
|
|
6
6
|
const workerFileSubject = new BehaviorSubject();
|
|
@@ -75,14 +75,21 @@ const run = singleshot(async (__filename, cb = () => { }) => {
|
|
|
75
75
|
if (!parentPort) {
|
|
76
76
|
throw new Error("workertest parentPort is null");
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
78
|
+
const finishTest = singleshot((status, msg) => {
|
|
79
|
+
parentPort.postMessage({ status, msg });
|
|
80
|
+
process.exit(0);
|
|
81
|
+
});
|
|
82
|
+
process.on('uncaughtException', function (err) {
|
|
83
|
+
// fail current test in worker
|
|
84
|
+
finishTest("fail", `Uncaught exception: ${getErrorMessage(err)}`);
|
|
85
|
+
});
|
|
86
|
+
process.on('unhandledRejection', (error) => {
|
|
87
|
+
throw error;
|
|
88
|
+
});
|
|
89
|
+
testRegistry.get(workerData.testName).cb({
|
|
90
|
+
pass: (msg) => finishTest("pass", msg),
|
|
91
|
+
fail: (msg) => finishTest("fail", msg),
|
|
92
|
+
});
|
|
86
93
|
});
|
|
87
94
|
|
|
88
95
|
export { run, test };
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "worker-testbed",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "The AI-ready testbed which use Worker Threads to create isolated vm context",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Petr Tripolsky",
|
|
7
|
-
"email": "tripolskypetr@gmail.com",
|
|
8
|
-
"url": "https://github.com/tripolskypetr"
|
|
9
|
-
},
|
|
10
|
-
"funding": {
|
|
11
|
-
"type": "individual",
|
|
12
|
-
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
-
},
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"homepage": "https://react-declarative-playground.github.io",
|
|
16
|
-
"keywords": [
|
|
17
|
-
"react-declarative",
|
|
18
|
-
"dependency-injection",
|
|
19
|
-
"nodejs",
|
|
20
|
-
"transient",
|
|
21
|
-
"stateless",
|
|
22
|
-
"asp.net core"
|
|
23
|
-
],
|
|
24
|
-
"files": [
|
|
25
|
-
"build",
|
|
26
|
-
"types.d.ts",
|
|
27
|
-
"README.md"
|
|
28
|
-
],
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "https://github.com/react-declarative/react-declarative",
|
|
32
|
-
"documentation": "https://github.com/react-declarative/react-declarative/tree/master/docs"
|
|
33
|
-
},
|
|
34
|
-
"bugs": {
|
|
35
|
-
"url": "https://github.com/react-declarative/react-declarative/issues"
|
|
36
|
-
},
|
|
37
|
-
"scripts": {
|
|
38
|
-
"build": "rollup -c",
|
|
39
|
-
"test": "npm run build && node ./test/test.mjs"
|
|
40
|
-
},
|
|
41
|
-
"main": "build/index.cjs",
|
|
42
|
-
"module": "build/index.mjs",
|
|
43
|
-
"source": "src/index.ts",
|
|
44
|
-
"types": "./types.d.ts",
|
|
45
|
-
"exports": {
|
|
46
|
-
"require": "./build/index.cjs",
|
|
47
|
-
"types": "./types.d.ts",
|
|
48
|
-
"import": "./build/index.mjs",
|
|
49
|
-
"default": "./build/index.cjs"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@rollup/plugin-typescript": "11.1.6",
|
|
53
|
-
"@types/node": "22.9.0",
|
|
54
|
-
"@types/tape": "^5.8.1",
|
|
55
|
-
"rollup": "3.29.4",
|
|
56
|
-
"rollup-plugin-dts": "6.1.1",
|
|
57
|
-
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
58
|
-
"tslib": "2.7.0"
|
|
59
|
-
},
|
|
60
|
-
"peerDependencies": {
|
|
61
|
-
"typescript": "^5.0.0"
|
|
62
|
-
},
|
|
63
|
-
"dependencies": {
|
|
64
|
-
"functools-kit": "^1.0.
|
|
65
|
-
"tape": "^5.9.0"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "worker-testbed",
|
|
3
|
+
"version": "1.0.11",
|
|
4
|
+
"description": "The AI-ready testbed which use Worker Threads to create isolated vm context",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Petr Tripolsky",
|
|
7
|
+
"email": "tripolskypetr@gmail.com",
|
|
8
|
+
"url": "https://github.com/tripolskypetr"
|
|
9
|
+
},
|
|
10
|
+
"funding": {
|
|
11
|
+
"type": "individual",
|
|
12
|
+
"url": "http://paypal.me/tripolskypetr"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://react-declarative-playground.github.io",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"react-declarative",
|
|
18
|
+
"dependency-injection",
|
|
19
|
+
"nodejs",
|
|
20
|
+
"transient",
|
|
21
|
+
"stateless",
|
|
22
|
+
"asp.net core"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"build",
|
|
26
|
+
"types.d.ts",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/react-declarative/react-declarative",
|
|
32
|
+
"documentation": "https://github.com/react-declarative/react-declarative/tree/master/docs"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/react-declarative/react-declarative/issues"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rollup -c",
|
|
39
|
+
"test": "npm run build && node ./test/test.mjs"
|
|
40
|
+
},
|
|
41
|
+
"main": "build/index.cjs",
|
|
42
|
+
"module": "build/index.mjs",
|
|
43
|
+
"source": "src/index.ts",
|
|
44
|
+
"types": "./types.d.ts",
|
|
45
|
+
"exports": {
|
|
46
|
+
"require": "./build/index.cjs",
|
|
47
|
+
"types": "./types.d.ts",
|
|
48
|
+
"import": "./build/index.mjs",
|
|
49
|
+
"default": "./build/index.cjs"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@rollup/plugin-typescript": "11.1.6",
|
|
53
|
+
"@types/node": "22.9.0",
|
|
54
|
+
"@types/tape": "^5.8.1",
|
|
55
|
+
"rollup": "3.29.4",
|
|
56
|
+
"rollup-plugin-dts": "6.1.1",
|
|
57
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
58
|
+
"tslib": "2.7.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"typescript": "^5.0.0"
|
|
62
|
+
},
|
|
63
|
+
"dependencies": {
|
|
64
|
+
"functools-kit": "^1.0.93",
|
|
65
|
+
"tape": "^5.9.0"
|
|
66
|
+
}
|
|
67
|
+
}
|