@hg-ts/tests 0.2.30 → 0.3.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/decorators/decorate-test.js +1 -4
- package/dist/decorators/decorate-test.js.map +1 -1
- package/dist/decorators/describe.decorator.d.ts.map +1 -1
- package/dist/decorators/describe.decorator.js +3 -6
- package/dist/decorators/describe.decorator.js.map +1 -1
- package/dist/decorators/expect-error.decorator.d.ts.map +1 -1
- package/dist/decorators/expect-error.decorator.js +6 -13
- package/dist/decorators/expect-error.decorator.js.map +1 -1
- package/dist/decorators/index.js +3 -6
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/test.decorator.js +1 -4
- package/dist/decorators/test.decorator.js.map +1 -1
- package/dist/example.test.js +35 -38
- package/dist/example.test.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -11
- package/dist/index.js.map +1 -1
- package/dist/runner.d.ts +1 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +24 -32
- package/dist/runner.js.map +1 -1
- package/dist/suite.d.ts +1 -2
- package/dist/suite.d.ts.map +1 -1
- package/dist/suite.js +1 -5
- package/dist/suite.js.map +1 -1
- package/dist/types.js +1 -2
- package/package.json +15 -13
- package/tsconfig.json +1 -1
- package/vitest.config.mjs +14 -0
- package/dist/expection.d.ts +0 -3
- package/dist/expection.d.ts.map +0 -1
- package/dist/expection.js +0 -7
- package/dist/expection.js.map +0 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTestDecorator = createTestDecorator;
|
|
4
|
-
function createTestDecorator(decorator) {
|
|
1
|
+
export function createTestDecorator(decorator) {
|
|
5
2
|
function result(_target, _key, descriptor) {
|
|
6
3
|
return {
|
|
7
4
|
async value(...args) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorate-test.js","sourceRoot":"","sources":["../../src/decorators/decorate-test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorate-test.js","sourceRoot":"","sources":["../../src/decorators/decorate-test.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB,CAAC,SAAwB;IAC3D,SAAS,MAAM,CACd,OAAgB,EAChB,IAAY,EACZ,UAA0E;QAE1E,OAAO;YACN,KAAK,CAAC,KAAK,CAAC,GAAG,IAAe;gBAE7B,MAAM,IAAI,GAAG,IAAI,CAAC;gBAClB,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;gBAChC,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;oBAClC,MAAM,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;gBAC7C,CAAC;YACF,CAAC;SACD,CAAC;IACH,CAAC;IAED,OAAO,MAAyB,CAAC;AAClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/describe.decorator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,QAAQ,CAAC,CAAC,SAAS,gBAAgB,EAAE,OAAO,GAAE,WAAgB,GAAG,mBAAmB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"describe.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/describe.decorator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,QAAQ,CAAC,CAAC,SAAS,gBAAgB,EAAE,OAAO,GAAE,WAAgB,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAKtG"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Describe = Describe;
|
|
4
|
-
const runner_1 = require("../runner");
|
|
5
|
-
function Describe(options = {}) {
|
|
1
|
+
import { Runner } from '../runner';
|
|
2
|
+
export function Describe(options = {}) {
|
|
6
3
|
return (target) => {
|
|
7
|
-
|
|
4
|
+
Runner.run(target, options);
|
|
8
5
|
};
|
|
9
6
|
}
|
|
10
7
|
//# sourceMappingURL=describe.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"describe.decorator.js","sourceRoot":"","sources":["../../src/decorators/describe.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"describe.decorator.js","sourceRoot":"","sources":["../../src/decorators/describe.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAInC,MAAM,UAAU,QAAQ,CAA6B,UAAuB,EAAE;IAC7E,OAAO,CAAC,MAAS,EAAQ,EAAE;QAE1B,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expect-error.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/expect-error.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expect-error.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/expect-error.decorator.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAgB1E"}
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const expection_1 = require("../expection");
|
|
6
|
-
const decorate_test_1 = require("./decorate-test");
|
|
7
|
-
function ExpectException(error) {
|
|
8
|
-
return (0, decorate_test_1.createTestDecorator)(async (method) => {
|
|
1
|
+
import { expect } from 'vitest';
|
|
2
|
+
import { createTestDecorator } from './decorate-test';
|
|
3
|
+
export function ExpectException(error) {
|
|
4
|
+
return createTestDecorator(async (method) => {
|
|
9
5
|
let isThrowError = false;
|
|
10
6
|
try {
|
|
11
7
|
await method();
|
|
12
8
|
}
|
|
13
9
|
catch (err) {
|
|
14
10
|
isThrowError = true;
|
|
15
|
-
if (err instanceof expect_1.JestAssertionError) {
|
|
16
|
-
throw err;
|
|
17
|
-
}
|
|
18
11
|
if (error) {
|
|
19
|
-
|
|
12
|
+
expect(err).toBeInstanceOf(error);
|
|
20
13
|
}
|
|
21
14
|
}
|
|
22
15
|
finally {
|
|
23
|
-
|
|
16
|
+
expect(isThrowError).toBeTruthy();
|
|
24
17
|
}
|
|
25
18
|
});
|
|
26
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expect-error.decorator.js","sourceRoot":"","sources":["../../src/decorators/expect-error.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expect-error.decorator.js","sourceRoot":"","sources":["../../src/decorators/expect-error.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,UAAU,eAAe,CAAC,KAAyB;IACxD,OAAO,mBAAmB,CAAC,KAAK,EAAC,MAA2B,EAAE,EAAE;QAC/D,IAAI,YAAY,GAAG,KAAK,CAAC;QAEzB,IAAI,CAAC;YACJ,MAAM,MAAM,EAAE,CAAC;QAChB,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACvB,YAAY,GAAG,IAAI,CAAC;YAEpB,IAAI,KAAK,EAAE,CAAC;gBACX,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;QACF,CAAC;gBAAS,CAAC;YACV,MAAM,CAAC,YAAY,CAAC,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/decorators/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./expect-error.decorator"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./describe.decorator"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./test.decorator"), exports);
|
|
1
|
+
export * from './expect-error.decorator';
|
|
2
|
+
export * from './describe.decorator';
|
|
3
|
+
export * from './test.decorator';
|
|
7
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.decorator.js","sourceRoot":"","sources":["../../src/decorators/test.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.decorator.js","sourceRoot":"","sources":["../../src/decorators/test.decorator.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,IAAI,CAAC,UAAuB,EAAE;IAC7C,OAAO,CACN,MAAc,EACd,WAAuB,EAChB,EAAE;QACT,MAAM,KAAK,GAAG,MAAe,CAAC;QAE9B,KAAK,CAAC,QAAQ,KAAK,IAAI,GAAG,EAAE,CAAC;QAC7B,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC,CAAC;AACH,CAAC"}
|
package/dist/example.test.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const expection_1 = require("./expection");
|
|
7
|
-
const suite_1 = require("./suite");
|
|
8
|
-
let ExampleTestSuite = class ExampleTestSuite extends suite_1.Suite {
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { expect } from 'vitest';
|
|
3
|
+
import { Describe, ExpectException, Test, } from './decorators';
|
|
4
|
+
import { Suite } from './suite';
|
|
5
|
+
let ExampleTestSuite = class ExampleTestSuite extends Suite {
|
|
9
6
|
async success() {
|
|
10
|
-
|
|
7
|
+
expect(true).toBeTruthy();
|
|
11
8
|
}
|
|
12
9
|
async failed() {
|
|
13
10
|
throw new Error('Failed test');
|
|
@@ -16,39 +13,39 @@ let ExampleTestSuite = class ExampleTestSuite extends suite_1.Suite {
|
|
|
16
13
|
async skip() { }
|
|
17
14
|
async only() { }
|
|
18
15
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
16
|
+
__decorate([
|
|
17
|
+
Test(),
|
|
18
|
+
__metadata("design:type", Function),
|
|
19
|
+
__metadata("design:paramtypes", []),
|
|
20
|
+
__metadata("design:returntype", Promise)
|
|
25
21
|
], ExampleTestSuite.prototype, "success", null);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
__decorate([
|
|
23
|
+
ExpectException(Error),
|
|
24
|
+
Test(),
|
|
25
|
+
__metadata("design:type", Function),
|
|
26
|
+
__metadata("design:paramtypes", []),
|
|
27
|
+
__metadata("design:returntype", Promise)
|
|
32
28
|
], ExampleTestSuite.prototype, "failed", null);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
__decorate([
|
|
30
|
+
Test({ todo: true }),
|
|
31
|
+
__metadata("design:type", Function),
|
|
32
|
+
__metadata("design:paramtypes", []),
|
|
33
|
+
__metadata("design:returntype", Promise)
|
|
38
34
|
], ExampleTestSuite.prototype, "todo", null);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
__decorate([
|
|
36
|
+
Test({ skip: true }),
|
|
37
|
+
__metadata("design:type", Function),
|
|
38
|
+
__metadata("design:paramtypes", []),
|
|
39
|
+
__metadata("design:returntype", Promise)
|
|
44
40
|
], ExampleTestSuite.prototype, "skip", null);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
__decorate([
|
|
42
|
+
Test({ only: true }),
|
|
43
|
+
__metadata("design:type", Function),
|
|
44
|
+
__metadata("design:paramtypes", []),
|
|
45
|
+
__metadata("design:returntype", Promise)
|
|
50
46
|
], ExampleTestSuite.prototype, "only", null);
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
ExampleTestSuite = __decorate([
|
|
48
|
+
Describe()
|
|
53
49
|
], ExampleTestSuite);
|
|
50
|
+
export { ExampleTestSuite };
|
|
54
51
|
//# sourceMappingURL=example.test.js.map
|
package/dist/example.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.test.js","sourceRoot":"","sources":["../src/example.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"example.test.js","sourceRoot":"","sources":["../src/example.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EACN,QAAQ,EACR,eAAe,EACf,IAAI,GACJ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGzB,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,KAAK;IAE7B,AAAN,KAAK,CAAC,OAAO;QACnB,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAIY,AAAN,KAAK,CAAC,MAAM;QAClB,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;IAGY,AAAN,KAAK,CAAC,IAAI,KAAmB,CAAC;IAGxB,AAAN,KAAK,CAAC,IAAI,KAAmB,CAAC;IAGxB,AAAN,KAAK,CAAC,IAAI,KAAmB,CAAC;CACrC,CAAA;AAlBa;IADZ,IAAI,EAAE;;;;+CAGN;AAIY;IAFZ,eAAe,CAAC,KAAK,CAAC;IACtB,IAAI,EAAE;;;;8CAGN;AAGY;IADZ,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;;;4CACgB;AAGxB;IADZ,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;;;4CACgB;AAGxB;IADZ,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;;;4CACgB;AAnBzB,gBAAgB;IAD5B,QAAQ,EAAE;GACE,gBAAgB,CAoB5B"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var decorators_1 = require("./decorators");
|
|
5
|
-
Object.defineProperty(exports, "Describe", { enumerable: true, get: function () { return decorators_1.Describe; } });
|
|
6
|
-
Object.defineProperty(exports, "Test", { enumerable: true, get: function () { return decorators_1.Test; } });
|
|
7
|
-
Object.defineProperty(exports, "ExpectException", { enumerable: true, get: function () { return decorators_1.ExpectException; } });
|
|
8
|
-
var suite_1 = require("./suite");
|
|
9
|
-
Object.defineProperty(exports, "Suite", { enumerable: true, get: function () { return suite_1.Suite; } });
|
|
10
|
-
var expection_1 = require("./expection");
|
|
11
|
-
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return expection_1.expect; } });
|
|
1
|
+
export { Describe, Test, ExpectException } from './decorators';
|
|
2
|
+
export { Suite } from './suite';
|
|
3
|
+
export { expect } from 'vitest';
|
|
12
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/runner.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SuiteConstructor } from './suite';
|
|
2
2
|
import type { TestOptions } from './types';
|
|
3
3
|
export declare class Runner {
|
|
4
|
-
static run(suiteConstructor: SuiteConstructor, options?: TestOptions): void
|
|
4
|
+
static run(suiteConstructor: SuiteConstructor, options?: TestOptions): Promise<void>;
|
|
5
5
|
private static describe;
|
|
6
6
|
private static registerTests;
|
|
7
7
|
private static getTestMethod;
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEX,gBAAgB,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAGX,WAAW,EACX,MAAM,SAAS,CAAC;AAEjB,qBAAa,MAAM;WACE,GAAG,CACtB,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,GAAE,WAAgB,GACvB,OAAO,CAAC,IAAI,CAAC;IAqBhB,OAAO,CAAC,MAAM,CAAC,QAAQ;IAiBvB,OAAO,CAAC,MAAM,CAAC,aAAa;IAa5B,OAAO,CAAC,MAAM,CAAC,aAAa;CAU5B"}
|
package/dist/runner.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, test, } from 'vitest';
|
|
2
|
+
export class Runner {
|
|
3
|
+
static async run(suiteConstructor, options = {}) {
|
|
4
|
+
let moddedDescribe = describe;
|
|
5
|
+
if (options.only) {
|
|
6
|
+
moddedDescribe = moddedDescribe.only;
|
|
7
|
+
}
|
|
8
|
+
if (options.todo) {
|
|
9
|
+
moddedDescribe = moddedDescribe.todo;
|
|
10
|
+
}
|
|
11
|
+
if (options.skip) {
|
|
12
|
+
moddedDescribe = moddedDescribe.skip;
|
|
13
|
+
}
|
|
14
|
+
moddedDescribe(options.name ?? suiteConstructor.name, this.describe.bind(this, suiteConstructor));
|
|
13
15
|
}
|
|
14
|
-
static describe(suiteConstructor
|
|
15
|
-
const suite = new suiteConstructor(
|
|
16
|
+
static describe(suiteConstructor) {
|
|
17
|
+
const suite = new suiteConstructor();
|
|
16
18
|
suite.testsMap = suiteConstructor.prototype.testsMap;
|
|
17
|
-
(
|
|
18
|
-
(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
expection_1.expect.setState({
|
|
22
|
-
assertionCalls: 0,
|
|
23
|
-
expectedAssertionsNumber: null,
|
|
24
|
-
isExpectingAssertions: false,
|
|
25
|
-
});
|
|
26
|
-
await suite.afterEach();
|
|
27
|
-
});
|
|
19
|
+
beforeAll(async () => suite.setUp());
|
|
20
|
+
afterAll(async () => suite.tearDown());
|
|
21
|
+
beforeEach(async () => suite.beforeEach());
|
|
22
|
+
afterEach(async () => suite.afterEach());
|
|
28
23
|
if (!suite.testsMap) {
|
|
29
24
|
suite.testsMap = new Map();
|
|
30
25
|
}
|
|
@@ -33,7 +28,7 @@ class Runner {
|
|
|
33
28
|
static registerTests(suite, options, testName) {
|
|
34
29
|
const { name = testName.toString() } = options;
|
|
35
30
|
const method = this.getTestMethod(suite, testName);
|
|
36
|
-
|
|
31
|
+
test(name, {
|
|
37
32
|
only: options.only ?? false,
|
|
38
33
|
todo: options.todo ?? false,
|
|
39
34
|
skip: options.skip ?? false,
|
|
@@ -41,14 +36,11 @@ class Runner {
|
|
|
41
36
|
}
|
|
42
37
|
static getTestMethod(suite, methodName) {
|
|
43
38
|
const testMethod = suite[methodName].bind(suite);
|
|
39
|
+
Object.defineProperty(testMethod, 'name', { value: methodName });
|
|
40
|
+
const fieldNameWrapper = { [methodName]: testMethod };
|
|
44
41
|
return async (...args) => {
|
|
45
|
-
await
|
|
46
|
-
const { expectedAssertionsNumber, assertionCalls } = expection_1.expect.getState();
|
|
47
|
-
if (typeof expectedAssertionsNumber === 'number') {
|
|
48
|
-
(0, expection_1.expect)(assertionCalls).toBe(expectedAssertionsNumber);
|
|
49
|
-
}
|
|
42
|
+
await fieldNameWrapper[methodName](...args);
|
|
50
43
|
};
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
|
-
exports.Runner = Runner;
|
|
54
46
|
//# sourceMappingURL=runner.js.map
|
package/dist/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EAER,IAAI,GACJ,MAAM,QAAQ,CAAC;AAYhB,MAAM,OAAO,MAAM;IACX,MAAM,CAAC,KAAK,CAAC,GAAG,CACtB,gBAAkC,EAClC,UAAuB,EAAE;QAEzB,IAAI,cAAc,GAAa,QAAQ,CAAC;QAExC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,cAAc,GAAG,cAAc,CAAC,IAAgB,CAAC;QAClD,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,cAAc,GAAG,cAAc,CAAC,IAAgB,CAAC;QAClD,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,cAAc,GAAG,cAAc,CAAC,IAAgB,CAAC;QAClD,CAAC;QAED,cAAc,CACb,OAAO,CAAC,IAAI,IAAI,gBAAgB,CAAC,IAAI,EACrC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAC1C,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAC,gBAAkC;QACzD,MAAM,KAAK,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACrC,KAAK,CAAC,QAAQ,GAAG,gBAAgB,CAAC,SAAS,CAAC,QAAQ,CAAC;QAErD,SAAS,CAAC,KAAK,IAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QACpC,QAAQ,CAAC,KAAK,IAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEtC,UAAU,CAAC,KAAK,IAAG,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1C,SAAS,CAAC,KAAK,IAAG,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QAExC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACrB,KAAK,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC5B,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IACjG,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,KAAY,EAAE,OAAoB,EAAE,QAAoB;QACpF,MAAM,EAAE,IAAI,GAAG,QAAQ,CAAC,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC;QAE/C,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAGnD,IAAI,CAAC,IAAI,EAAE;YACV,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK;YAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK;YAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK;SAC3B,EAAE,MAAM,CAAC,CAAC;IACZ,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,KAAY,EAAE,UAAsB;QAChE,MAAM,UAAU,GAAK,KAAa,CAAC,UAAU,CAA2C,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrG,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QAEjE,MAAM,gBAAgB,GAAQ,EAAE,CAAC,UAAU,CAAC,EAAE,UAAU,EAAW,CAAC;QAEpE,OAAO,KAAK,EAAC,GAAG,IAAW,EAAiB,EAAE;YAC7C,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7C,CAAC,CAAC;IACH,CAAC;CACD"}
|
package/dist/suite.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { SuiteContext } from 'node:test';
|
|
2
1
|
import type { MethodName, TestOptions } from './types';
|
|
3
|
-
export type SuiteConstructor = new (
|
|
2
|
+
export type SuiteConstructor = new () => Suite;
|
|
4
3
|
export declare abstract class Suite {
|
|
5
4
|
testsMap: Map<MethodName, TestOptions> | null;
|
|
6
5
|
setUp(): Promise<void>;
|
package/dist/suite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../src/suite.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../src/suite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,UAAU,EACV,WAAW,EACX,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,gBAAgB,GAAG,UAAU,KAAK,CAAC;AAE/C,8BAAsB,KAAK;IACnB,QAAQ,EAAE,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC;IAExC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAEtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAEzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CACvC"}
|
package/dist/suite.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Suite = void 0;
|
|
4
|
-
class Suite {
|
|
1
|
+
export class Suite {
|
|
5
2
|
testsMap;
|
|
6
3
|
async setUp() { }
|
|
7
4
|
async tearDown() { }
|
|
8
5
|
async beforeEach() { }
|
|
9
6
|
async afterEach() { }
|
|
10
7
|
}
|
|
11
|
-
exports.Suite = Suite;
|
|
12
8
|
//# sourceMappingURL=suite.js.map
|
package/dist/suite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suite.js","sourceRoot":"","sources":["../src/suite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suite.js","sourceRoot":"","sources":["../src/suite.ts"],"names":[],"mappings":"AAOA,MAAM,OAAgB,KAAK;IACnB,QAAQ,CAAsC;IAE9C,KAAK,CAAC,KAAK,KAAmB,CAAC;IAE/B,KAAK,CAAC,QAAQ,KAAmB,CAAC;IAElC,KAAK,CAAC,UAAU,KAAmB,CAAC;IAEpC,KAAK,CAAC,SAAS,KAAmB,CAAC;CAC1C"}
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hg-ts/tests",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"exports": {
|
|
6
|
-
".": "./dist/index.js"
|
|
6
|
+
".": "./dist/index.js",
|
|
7
|
+
"./config": "./vitest.config.mjs"
|
|
7
8
|
},
|
|
8
9
|
"repository": "git@gitlab.com:hyper-graph/framework.git",
|
|
9
10
|
"scripts": {
|
|
@@ -13,27 +14,28 @@
|
|
|
13
14
|
"build:dev": "tsc-watch",
|
|
14
15
|
"lint:ts": "lint-ts",
|
|
15
16
|
"lint:ts:fix": "lint-ts --fix",
|
|
16
|
-
"test": "HG_ENV=test
|
|
17
|
-
"test:dev": "
|
|
17
|
+
"test": "HG_ENV=test vitest run",
|
|
18
|
+
"test:dev": "HG_ENV=test vitest watch"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"@hg-ts-config/typescript": "0.
|
|
21
|
-
"@hg-ts/linter": "0.
|
|
22
|
-
"@hg-ts/types": "0.
|
|
23
|
-
"@
|
|
21
|
+
"@hg-ts-config/typescript": "0.3.0",
|
|
22
|
+
"@hg-ts/linter": "0.3.0",
|
|
23
|
+
"@hg-ts/types": "0.3.0",
|
|
24
|
+
"@swc/core": "1.15.3",
|
|
25
|
+
"@types/node": "22.19.1",
|
|
24
26
|
"eslint": "9.18.0",
|
|
25
27
|
"reflect-metadata": "0.2.2",
|
|
26
28
|
"ts-node": "10.9.2",
|
|
27
29
|
"tsc-watch": "6.3.0",
|
|
28
30
|
"tslib": "2.8.1",
|
|
29
31
|
"tsx": "4.19.2",
|
|
30
|
-
"typescript": "5.7.3"
|
|
32
|
+
"typescript": "5.7.3",
|
|
33
|
+
"unplugin-swc": "1.5.9",
|
|
34
|
+
"vitest": "4.0.14"
|
|
31
35
|
},
|
|
32
36
|
"peerDependencies": {
|
|
33
37
|
"reflect-metadata": "*",
|
|
34
|
-
"tslib": "*"
|
|
35
|
-
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"expect": "29.7.0"
|
|
38
|
+
"tslib": "*",
|
|
39
|
+
"vitest": "*"
|
|
38
40
|
}
|
|
39
41
|
}
|
package/tsconfig.json
CHANGED
package/dist/expection.d.ts
DELETED
package/dist/expection.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"expection.d.ts","sourceRoot":"","sources":["../src/expection.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,QAAQ,CAAC;AAMhC,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,CAAC"}
|
package/dist/expection.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.expect = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const expect_1 = tslib_1.__importDefault(require("expect"));
|
|
6
|
-
exports.expect = expect_1.default;
|
|
7
|
-
//# sourceMappingURL=expection.js.map
|
package/dist/expection.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"expection.js","sourceRoot":"","sources":["../src/expection.ts"],"names":[],"mappings":";;;;AAAA,4DAAgC;AAMT,iBANhB,gBAAU,CAMY"}
|