@hg-ts/tests 0.1.88 → 0.1.90

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.
@@ -10,7 +10,7 @@ let ExampleTestSuite = class ExampleTestSuite extends suite_1.Suite {
10
10
  (0, expection_1.expect)(true).toBeTruthy();
11
11
  }
12
12
  async failed() {
13
- (0, expection_1.expect)(false).toBeTruthy();
13
+ throw new Error('Failed test');
14
14
  }
15
15
  async todo() { }
16
16
  async skip() { }
@@ -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,IAAA,kBAAM,EAAC,KAAK,CAAC,CAAC,UAAU,EAAE,CAAC;IAC5B,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,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"}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@hg-ts/tests",
3
- "version": "0.1.88",
3
+ "version": "0.1.90",
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",
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
  "test": "node --test",
@@ -15,9 +16,9 @@
15
16
  "lint:ts:fix": "lint-ts --fix"
16
17
  },
17
18
  "devDependencies": {
18
- "@hg-ts-config/typescript": "0.1.88",
19
- "@hg-ts/linter": "0.1.88",
20
- "@hg-ts/types": "0.1.88",
19
+ "@hg-ts-config/typescript": "0.1.90",
20
+ "@hg-ts/linter": "0.1.90",
21
+ "@hg-ts/types": "0.1.90",
21
22
  "@types/node": "22.10.6",
22
23
  "eslint": "9.18.0",
23
24
  "reflect-metadata": "0.2.2",
@@ -1,4 +0,0 @@
1
- import { type TestOptions } from '../test-runner';
2
- import type { TestSuiteConstructor } from '../test-suite';
3
- export declare function Suite<T extends TestSuiteConstructor>(options?: TestOptions): TypedClassDecorator<T>;
4
- //# sourceMappingURL=suite.decorator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"suite.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/suite.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,WAAW,EAEhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,wBAAgB,KAAK,CAAC,CAAC,SAAS,oBAAoB,EAAE,OAAO,GAAE,WAAgB,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAIvG"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Suite = Suite;
4
- const test_runner_1 = require("../test-runner");
5
- function Suite(options = {}) {
6
- return (target) => {
7
- test_runner_1.TestRunner.run(target, options);
8
- };
9
- }
10
- //# sourceMappingURL=suite.decorator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"suite.decorator.js","sourceRoot":"","sources":["../../src/decorators/suite.decorator.ts"],"names":[],"mappings":";;AAMA,sBAIC;AAVD,gDAGwB;AAGxB,SAAgB,KAAK,CAAiC,UAAuB,EAAE;IAC9E,OAAO,CAAC,MAAS,EAAQ,EAAE;QAC1B,wBAAU,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC;AACH,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { TestSuiteConstructor } from './test-suite';
2
- export type TestMethod = (...args: unknown[]) => Promise<void>;
3
- export type MethodName = string | symbol;
4
- export type TestOptions = {
5
- name?: string;
6
- only?: boolean;
7
- skip?: boolean;
8
- todo?: boolean;
9
- };
10
- export declare class TestRunner {
11
- static run(suiteConstructor: TestSuiteConstructor, options?: TestOptions): void;
12
- private static describe;
13
- private static registerTests;
14
- private static getTestMethod;
15
- }
16
- //# sourceMappingURL=test-runner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-runner.d.ts","sourceRoot":"","sources":["../src/test-runner.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAa,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/D,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,qBAAa,UAAU;WACR,GAAG,CAChB,gBAAgB,EAAE,oBAAoB,EACtC,OAAO,GAAE,WAAgB,GACvB,IAAI;IAaP,OAAO,CAAC,MAAM,CAAC,QAAQ;IAuBvB,OAAO,CAAC,MAAM,CAAC,aAAa;IAa5B,OAAO,CAAC,MAAM,CAAC,aAAa;CAY5B"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestRunner = void 0;
4
- const node_test_1 = require("node:test");
5
- const expection_1 = require("./expection");
6
- class TestRunner {
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));
13
- }
14
- static describe(suiteConstructor, context) {
15
- const suite = new suiteConstructor(context);
16
- 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
- });
28
- if (!suite.testsMap) {
29
- suite.testsMap = new Map();
30
- }
31
- suite.testsMap.forEach((options, methodName) => this.registerTests(suite, options, methodName));
32
- }
33
- static registerTests(suite, options, testName) {
34
- const { name = testName.toString() } = options;
35
- const method = this.getTestMethod(suite, testName);
36
- (0, node_test_1.test)(name, {
37
- only: options.only ?? false,
38
- todo: options.todo ?? false,
39
- skip: options.skip ?? false,
40
- }, method);
41
- }
42
- static getTestMethod(suite, methodName) {
43
- const testMethod = suite[methodName].bind(suite);
44
- 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
- }
50
- };
51
- }
52
- }
53
- exports.TestRunner = TestRunner;
54
- //# sourceMappingURL=test-runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-runner.js","sourceRoot":"","sources":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ner';
3
- export type TestSuiteConstructor = new (context: SuiteContext) => TestSuite;
4
- export declare abstract class TestSuite {
5
- testsMap: Map<MethodName, TestOptions> | null;
6
- setUp(): Promise<void>;
7
- tearDown(): Promise<void>;
8
- beforeEach(): Promise<void>;
9
- afterEach(): Promise<void>;
10
- }
11
- //# sourceMappingURL=test-suite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-suite.d.ts","sourceRoot":"","sources":["../src/test-suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EACX,UAAU,EACV,WAAW,EACX,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,oBAAoB,GAAG,KAAK,OAAO,EAAE,YAAY,KAAK,SAAS,CAAC;AAC5E,8BAAsB,SAAS;IACvB,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,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestSuite = void 0;
4
- class TestSuite {
5
- testsMap;
6
- async setUp() { }
7
- async tearDown() { }
8
- async beforeEach() { }
9
- async afterEach() { }
10
- }
11
- exports.TestSuite = TestSuite;
12
- //# sourceMappingURL=test-suite.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-suite.js","sourceRoot":"","sources":["../src/test-suite.ts"],"names":[],"mappings":";;;AAOA,MAAsB,SAAS;IACvB,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,8BAUC"}