@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.
@@ -1,7 +1,4 @@
1
- "use strict";
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":";;AAEA,kDAmBC;AAnBD,SAAgB,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
+ {"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,CAItG"}
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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
- runner_1.Runner.run(target, options);
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":";;AAIA,4BAIC;AARD,sCAAmC;AAInC,SAAgB,QAAQ,CAA6B,UAAuB,EAAE;IAC7E,OAAO,CAAC,MAAS,EAAQ,EAAE;QAC1B,eAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC,CAAC;AACH,CAAC"}
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":"AAIA,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAmB1E"}
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExpectException = ExpectException;
4
- const expect_1 = require("expect");
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
- (0, expection_1.expect)(err).toBeInstanceOf(error);
12
+ expect(err).toBeInstanceOf(error);
20
13
  }
21
14
  }
22
15
  finally {
23
- (0, expection_1.expect)(isThrowError).toBeTruthy();
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":";;AAIA,0CAmBC;AAvBD,mCAA4C;AAC5C,4CAAsC;AACtC,mDAAsD;AAEtD,SAAgB,eAAe,CAAC,KAAyB;IACxD,OAAO,IAAA,mCAAmB,EAAC,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,GAAG,YAAY,2BAAkB,EAAE,CAAC;gBACvC,MAAM,GAAG,CAAC;YACX,CAAC;YACD,IAAI,KAAK,EAAE,CAAC;gBACX,IAAA,kBAAM,EAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;QACF,CAAC;gBAAS,CAAC;YACV,IAAA,kBAAM,EAAC,YAAY,CAAC,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
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"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
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":";;;AAAA,mEAAyC;AACzC,+DAAqC;AACrC,2DAAiC"}
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,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Test = Test;
4
- function Test(options = {}) {
1
+ export function Test(options = {}) {
5
2
  return (target, propertyKey) => {
6
3
  const suite = target;
7
4
  suite.testsMap ??= new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"test.decorator.js","sourceRoot":"","sources":["../../src/decorators/test.decorator.ts"],"names":[],"mappings":";;AAMA,oBAUC;AAVD,SAAgB,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"}
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"}
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExampleTestSuite = void 0;
4
- const tslib_1 = require("tslib");
5
- const decorators_1 = require("./decorators");
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
- (0, expection_1.expect)(true).toBeTruthy();
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
- exports.ExampleTestSuite = ExampleTestSuite;
20
- tslib_1.__decorate([
21
- (0, decorators_1.Test)(),
22
- tslib_1.__metadata("design:type", Function),
23
- tslib_1.__metadata("design:paramtypes", []),
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
- tslib_1.__decorate([
27
- (0, decorators_1.ExpectException)(Error),
28
- (0, decorators_1.Test)(),
29
- tslib_1.__metadata("design:type", Function),
30
- tslib_1.__metadata("design:paramtypes", []),
31
- tslib_1.__metadata("design:returntype", Promise)
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
- tslib_1.__decorate([
34
- (0, decorators_1.Test)({ todo: true }),
35
- tslib_1.__metadata("design:type", Function),
36
- tslib_1.__metadata("design:paramtypes", []),
37
- tslib_1.__metadata("design:returntype", Promise)
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
- tslib_1.__decorate([
40
- (0, decorators_1.Test)({ skip: true }),
41
- tslib_1.__metadata("design:type", Function),
42
- tslib_1.__metadata("design:paramtypes", []),
43
- tslib_1.__metadata("design:returntype", Promise)
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
- tslib_1.__decorate([
46
- (0, decorators_1.Test)({ only: true }),
47
- tslib_1.__metadata("design:type", Function),
48
- tslib_1.__metadata("design:paramtypes", []),
49
- tslib_1.__metadata("design:returntype", Promise)
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
- exports.ExampleTestSuite = ExampleTestSuite = tslib_1.__decorate([
52
- (0, decorators_1.Describe)()
47
+ ExampleTestSuite = __decorate([
48
+ Describe()
53
49
  ], ExampleTestSuite);
50
+ export { ExampleTestSuite };
54
51
  //# sourceMappingURL=example.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"example.test.js","sourceRoot":"","sources":["../src/example.test.ts"],"names":[],"mappings":";;;;AAAA,6CAIsB;AACtB,2CAAqC;AACrC,mCAAgC;AAGzB,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,aAAK;IAE7B,AAAN,KAAK,CAAC,OAAO;QACnB,IAAA,kBAAM,EAAC,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;AApBY,4CAAgB;AAEf;IADZ,IAAA,iBAAI,GAAE;;;;+CAGN;AAIY;IAFZ,IAAA,4BAAe,EAAC,KAAK,CAAC;IACtB,IAAA,iBAAI,GAAE;;;;8CAGN;AAGY;IADZ,IAAA,iBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;;;4CACgB;AAGxB;IADZ,IAAA,iBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;;;4CACgB;AAGxB;IADZ,IAAA,iBAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;;;4CACgB;2BAnBzB,gBAAgB;IAD5B,IAAA,qBAAQ,GAAE;GACE,gBAAgB,CAoB5B"}
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
@@ -1,4 +1,4 @@
1
1
  export { Describe, Test, ExpectException } from './decorators';
2
2
  export { Suite } from './suite';
3
- export { expect } from './expection';
3
+ export { expect } from 'vitest';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -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,aAAa,CAAC"}
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expect = exports.Suite = exports.ExpectException = exports.Test = exports.Describe = void 0;
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":";;;AAAA,2CAA+D;AAAtD,sGAAA,QAAQ,OAAA;AAAE,kGAAA,IAAI,OAAA;AAAE,6GAAA,eAAe,OAAA;AAExC,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,yCAAqC;AAA5B,mGAAA,MAAM,OAAA"}
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;
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAS,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAGX,WAAW,EACX,MAAM,SAAS,CAAC;AAEjB,qBAAa,MAAM;WACJ,GAAG,CAChB,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,GAAE,WAAgB,GACvB,IAAI;IAaP,OAAO,CAAC,MAAM,CAAC,QAAQ;IAwBvB,OAAO,CAAC,MAAM,CAAC,aAAa;IAa5B,OAAO,CAAC,MAAM,CAAC,aAAa;CAY5B"}
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Runner = void 0;
4
- const node_test_1 = require("node:test");
5
- const expection_1 = require("./expection");
6
- class Runner {
7
- static run(suiteConstructor, options = {}) {
8
- (0, node_test_1.describe)(options.name ?? suiteConstructor.name, {
9
- skip: options.skip ?? false,
10
- todo: options.todo ?? false,
11
- only: options.only ?? false,
12
- }, this.describe.bind(this, suiteConstructor));
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, context) {
15
- const suite = new suiteConstructor(context);
16
+ static describe(suiteConstructor) {
17
+ const suite = new suiteConstructor();
16
18
  suite.testsMap = suiteConstructor.prototype.testsMap;
17
- (0, node_test_1.before)(async () => suite.setUp());
18
- (0, node_test_1.after)(async () => suite.tearDown());
19
- (0, node_test_1.beforeEach)(async () => suite.beforeEach());
20
- (0, node_test_1.afterEach)(async () => {
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
- (0, node_test_1.test)(name, {
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 testMethod(...args);
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
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":";;;AAAA,yCAQmB;AACnB,2CAAqC;AAQrC,MAAa,MAAM;IACX,MAAM,CAAC,GAAG,CAChB,gBAAkC,EAClC,UAAuB,EAAE;QAGzB,IAAA,oBAAQ,EACP,OAAO,CAAC,IAAI,IAAI,gBAAgB,CAAC,IAAI,EACrC;YACC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK;YAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK;YAC3B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,KAAK;SAC3B,EACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAC1C,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,QAAQ,CAAC,gBAAkC,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AAI,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 (context: SuiteContext) => Suite;
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>;
@@ -1 +1 @@
1
- {"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../src/suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EACX,UAAU,EACV,WAAW,EACX,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,gBAAgB,GAAG,KAAK,OAAO,EAAE,YAAY,KAAK,KAAK,CAAC;AAEpE,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"}
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
- "use strict";
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":";;;AAQA,MAAsB,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;AAVD,sBAUC"}
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
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@hg-ts/tests",
3
- "version": "0.2.30",
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 node --require ts-node/register --test src/**/*.test.ts",
17
- "test:dev": "yarn build:dev --onSuccess \"yarn test\""
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.2.30",
21
- "@hg-ts/linter": "0.2.30",
22
- "@hg-ts/types": "0.2.30",
23
- "@types/node": "22.10.6",
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
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "@hg-ts-config/typescript/commonjs",
2
+ "extends": "@hg-ts-config/typescript/esm",
3
3
  "compilerOptions": {
4
4
  "baseUrl": "src",
5
5
  "rootDir": "src",
@@ -0,0 +1,14 @@
1
+ import swc from 'unplugin-swc';
2
+ import { defineConfig } from 'vitest/config';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ globals: true,
7
+ exclude: ['dist'],
8
+ },
9
+ plugins: [
10
+ swc.vite({
11
+ module: { type: 'es6' },
12
+ }),
13
+ ],
14
+ });
@@ -1,3 +0,0 @@
1
- import expectFunc from 'expect';
2
- export { expectFunc as expect };
3
- //# sourceMappingURL=expection.d.ts.map
@@ -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
@@ -1 +0,0 @@
1
- {"version":3,"file":"expection.js","sourceRoot":"","sources":["../src/expection.ts"],"names":[],"mappings":";;;;AAAA,4DAAgC;AAMT,iBANhB,gBAAU,CAMY"}