@hg-ts/exception 0.1.88 → 0.1.89
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
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hg-ts/exception",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.89",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"repository": "git@gitlab.com:hyper-graph/framework.git",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"prepack": "yarn build && yarn lint:ts && yarn test",
|
|
10
|
+
"prepack": "yarn clear && yarn build && yarn lint:ts && yarn test",
|
|
11
|
+
"clear": "rm -rf dist",
|
|
11
12
|
"build": "tsc",
|
|
12
13
|
"build:dev": "tsc-watch",
|
|
13
14
|
"lint:ts": "lint-ts",
|
|
@@ -16,10 +17,10 @@
|
|
|
16
17
|
"test:dev": "yarn build:dev --onSuccess \"yarn test\""
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@hg-ts-config/typescript": "0.1.
|
|
20
|
-
"@hg-ts/linter": "0.1.
|
|
21
|
-
"@hg-ts/tests": "0.1.
|
|
22
|
-
"@hg-ts/types": "0.1.
|
|
20
|
+
"@hg-ts-config/typescript": "0.1.89",
|
|
21
|
+
"@hg-ts/linter": "0.1.89",
|
|
22
|
+
"@hg-ts/tests": "0.1.89",
|
|
23
|
+
"@hg-ts/types": "0.1.89",
|
|
23
24
|
"@types/node": "22.10.6",
|
|
24
25
|
"eslint": "9.18.0",
|
|
25
26
|
"reflect-metadata": "0.2.2",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import '@hg-ts/types';
|
|
2
|
-
import { TestSuite } from '@hg-ts/tests';
|
|
3
|
-
export declare class SerializationTestSuite extends TestSuite {
|
|
4
|
-
commonTest(): Promise<void>;
|
|
5
|
-
baseExceptionFromError(): Promise<void>;
|
|
6
|
-
aggregateExceptionTest(): Promise<void>;
|
|
7
|
-
syncStackTest(): Promise<void>;
|
|
8
|
-
isFromNextTickTest(): Promise<void>;
|
|
9
|
-
isFromImmediateTest(): Promise<void>;
|
|
10
|
-
fromTimeoutTest(): Promise<void>;
|
|
11
|
-
fromIntervalTest(): Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=serialization.test-suite.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.test-suite.d.ts","sourceRoot":"","sources":["../../src/tests/serialization.test-suite.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AACtB,OAAO,EAEN,SAAS,EAGT,MAAM,cAAc,CAAC;AAStB,qBACa,sBAAuB,SAAQ,SAAS;IAEvC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3B,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAevC,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBvC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAO9B,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAYnC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAYpC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAYhC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAY9C"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SerializationTestSuite = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
require("@hg-ts/types");
|
|
6
|
-
const tests_1 = require("@hg-ts/tests");
|
|
7
|
-
const exceptions_1 = require("../exceptions");
|
|
8
|
-
const test_aggregate_exception_1 = require("./test.aggregate-exception");
|
|
9
|
-
const test_exception_1 = require("./test.exception");
|
|
10
|
-
let SerializationTestSuite = class SerializationTestSuite extends tests_1.TestSuite {
|
|
11
|
-
async commonTest() {
|
|
12
|
-
const message = 'Test message';
|
|
13
|
-
const exception = new test_exception_1.TestException(message);
|
|
14
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(Error);
|
|
15
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(exceptions_1.BaseException);
|
|
16
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(test_exception_1.TestException);
|
|
17
|
-
(0, tests_1.expect)(exception.message).toEqual(message);
|
|
18
|
-
(0, tests_1.expect)(exception.code).toBeNull();
|
|
19
|
-
(0, tests_1.expect)(exception.toJSON().name).toEqual(test_exception_1.TestException.name);
|
|
20
|
-
(0, tests_1.expect)(exception.toJSON().stack).toBeInstanceOf(Array);
|
|
21
|
-
(0, tests_1.expect)(exception.toJSON().stack).not.toEqual([]);
|
|
22
|
-
}
|
|
23
|
-
async baseExceptionFromError() {
|
|
24
|
-
const message = 'Test message';
|
|
25
|
-
const error = new Error(message);
|
|
26
|
-
const exception = exceptions_1.BaseException.fromError(error);
|
|
27
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(Error);
|
|
28
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(exceptions_1.BaseException);
|
|
29
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(exceptions_1.ErrorException);
|
|
30
|
-
(0, tests_1.expect)(exception.message).toEqual(message);
|
|
31
|
-
(0, tests_1.expect)(exception.code).toBeNull();
|
|
32
|
-
(0, tests_1.expect)(exception.toJSON().stack).toBeInstanceOf(Array);
|
|
33
|
-
(0, tests_1.expect)(exception.toJSON().stack).not.toEqual([]);
|
|
34
|
-
}
|
|
35
|
-
async aggregateExceptionTest() {
|
|
36
|
-
const message = 'Test aggregate message';
|
|
37
|
-
const exception = new test_aggregate_exception_1.TestAggregateException(message);
|
|
38
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(Error);
|
|
39
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(exceptions_1.BaseException);
|
|
40
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(exceptions_1.BaseAggregateException);
|
|
41
|
-
(0, tests_1.expect)(exception).toBeInstanceOf(test_aggregate_exception_1.TestAggregateException);
|
|
42
|
-
(0, tests_1.expect)(exception.message).toEqual(message);
|
|
43
|
-
(0, tests_1.expect)(exception.code).toBeNull();
|
|
44
|
-
(0, tests_1.expect)(exception.exceptions).toBeInstanceOf(Array);
|
|
45
|
-
(0, tests_1.expect)(exception.exceptions).toHaveLength(3);
|
|
46
|
-
}
|
|
47
|
-
async syncStackTest() {
|
|
48
|
-
const { stack } = new test_exception_1.TestException('Test message').toJSON();
|
|
49
|
-
(0, tests_1.expect)(stack[0].startsWith('at SerializationTestSuite.syncStackTest')).toBeTruthy();
|
|
50
|
-
}
|
|
51
|
-
async isFromNextTickTest() {
|
|
52
|
-
return new Promise(resolve => {
|
|
53
|
-
process.nextTick(() => {
|
|
54
|
-
const exception = new test_exception_1.TestException('Test message');
|
|
55
|
-
(0, tests_1.expect)(exception.isFromNextTick()).toBeTruthy();
|
|
56
|
-
resolve();
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
async isFromImmediateTest() {
|
|
61
|
-
return new Promise(resolve => {
|
|
62
|
-
setImmediate(() => {
|
|
63
|
-
const exception = new test_exception_1.TestException('Test message');
|
|
64
|
-
(0, tests_1.expect)(exception.isFromImmediate()).toBeTruthy();
|
|
65
|
-
resolve();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
async fromTimeoutTest() {
|
|
70
|
-
return new Promise(resolve => {
|
|
71
|
-
setTimeout(() => {
|
|
72
|
-
const exception = new test_exception_1.TestException('Test message');
|
|
73
|
-
(0, tests_1.expect)(exception.isFromTimer()).toBeTruthy();
|
|
74
|
-
resolve();
|
|
75
|
-
}, 0);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
async fromIntervalTest() {
|
|
79
|
-
let interval;
|
|
80
|
-
return new Promise(resolve => {
|
|
81
|
-
interval = setInterval(() => {
|
|
82
|
-
const exception = new test_exception_1.TestException('Test message');
|
|
83
|
-
(0, tests_1.expect)(exception.isFromTimer()).toBeTruthy();
|
|
84
|
-
clearInterval(interval);
|
|
85
|
-
resolve();
|
|
86
|
-
}, 0);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
exports.SerializationTestSuite = SerializationTestSuite;
|
|
91
|
-
tslib_1.__decorate([
|
|
92
|
-
(0, tests_1.Test)(),
|
|
93
|
-
tslib_1.__metadata("design:type", Function),
|
|
94
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
95
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
96
|
-
], SerializationTestSuite.prototype, "commonTest", null);
|
|
97
|
-
tslib_1.__decorate([
|
|
98
|
-
(0, tests_1.Test)(),
|
|
99
|
-
tslib_1.__metadata("design:type", Function),
|
|
100
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
101
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
102
|
-
], SerializationTestSuite.prototype, "baseExceptionFromError", null);
|
|
103
|
-
tslib_1.__decorate([
|
|
104
|
-
(0, tests_1.Test)(),
|
|
105
|
-
tslib_1.__metadata("design:type", Function),
|
|
106
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
107
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
108
|
-
], SerializationTestSuite.prototype, "aggregateExceptionTest", null);
|
|
109
|
-
tslib_1.__decorate([
|
|
110
|
-
(0, tests_1.Test)(),
|
|
111
|
-
tslib_1.__metadata("design:type", Function),
|
|
112
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
113
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
114
|
-
], SerializationTestSuite.prototype, "syncStackTest", null);
|
|
115
|
-
tslib_1.__decorate([
|
|
116
|
-
(0, tests_1.Test)(),
|
|
117
|
-
tslib_1.__metadata("design:type", Function),
|
|
118
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
119
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
120
|
-
], SerializationTestSuite.prototype, "isFromNextTickTest", null);
|
|
121
|
-
tslib_1.__decorate([
|
|
122
|
-
(0, tests_1.Test)(),
|
|
123
|
-
tslib_1.__metadata("design:type", Function),
|
|
124
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
125
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
126
|
-
], SerializationTestSuite.prototype, "isFromImmediateTest", null);
|
|
127
|
-
tslib_1.__decorate([
|
|
128
|
-
(0, tests_1.Test)(),
|
|
129
|
-
tslib_1.__metadata("design:type", Function),
|
|
130
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
131
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
132
|
-
], SerializationTestSuite.prototype, "fromTimeoutTest", null);
|
|
133
|
-
tslib_1.__decorate([
|
|
134
|
-
(0, tests_1.Test)(),
|
|
135
|
-
tslib_1.__metadata("design:type", Function),
|
|
136
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
137
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
138
|
-
], SerializationTestSuite.prototype, "fromIntervalTest", null);
|
|
139
|
-
exports.SerializationTestSuite = SerializationTestSuite = tslib_1.__decorate([
|
|
140
|
-
(0, tests_1.Suite)()
|
|
141
|
-
], SerializationTestSuite);
|
|
142
|
-
//# sourceMappingURL=serialization.test-suite.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.test-suite.js","sourceRoot":"","sources":["../../src/tests/serialization.test-suite.ts"],"names":[],"mappings":";;;;AAAA,wBAAsB;AACtB,wCAKsB;AACtB,8CAIuB;AACvB,yEAAoE;AACpE,qDAAiD;AAG1C,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,iBAAS;IAEvC,AAAN,KAAK,CAAC,UAAU;QACtB,MAAM,OAAO,GAAG,cAAc,CAAC;QAC/B,MAA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