@hg-ts/tests 0.5.20 → 0.5.22

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 +1 @@
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,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAuB9G"}
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,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAyB9G"}
@@ -8,14 +8,16 @@ export function ExpectException(error, name, message) {
8
8
  }
9
9
  catch (err) {
10
10
  isThrowError = true;
11
- expect(err, 'Exception type check').toBeInstanceOf(error);
12
- if (err instanceof Error) {
13
- if (name) {
14
- expect(name, 'Exception name check').toBe(name);
15
- }
16
- if (message) {
17
- expect(message, 'Exception message check').toBe(message);
18
- }
11
+ if (error) {
12
+ expect(err, 'Exception type check').toBeInstanceOf(error);
13
+ }
14
+ if (name) {
15
+ expect(err, 'Exception must be instance of Error to check name').toBeInstanceOf(Error);
16
+ expect(err.name, 'Exception name check').toBe(name);
17
+ }
18
+ if (message) {
19
+ expect(err, 'Exception must be instance of Error to check message').toBeInstanceOf(Error);
20
+ expect(err.message, 'Exception message check').toBe(message);
19
21
  }
20
22
  }
21
23
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"expect-error.decorator.js","sourceRoot":"","sources":["../../src/decorators/expect-error.decorator.ts"],"names":[],"mappings":"A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I,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,EAAE,sBAAsB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC3D,CAAC;YAED,IAAI,IAAI,EAAE,CAAC;gBACV,MAAM,CAAC,GAAG,EAAE,mDAAmD,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBACvF,MAAM,CAAE,GAAa,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChE,CAAC;YACD,IAAI,OAAO,EAAE,CAAC;gBACb,MAAM,CAAC,GAAG,EAAE,sDAAsD,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;gBAC1F,MAAM,CAAE,GAAa,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzE,CAAC;QACF,CAAC;gBAAS,CAAC;YACV,MAAM,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAC,UAAU,EAAE,CAAC;QAC7D,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hg-ts/tests",
3
- "version": "0.5.20",
3
+ "version": "0.5.22",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,9 +24,9 @@
24
24
  "unplugin-swc": "1.5.9"
25
25
  },
26
26
  "devDependencies": {
27
- "@hg-ts-config/typescript": "0.5.20",
28
- "@hg-ts/linter": "0.5.20",
29
- "@hg-ts/types": "0.5.20",
27
+ "@hg-ts-config/typescript": "0.5.22",
28
+ "@hg-ts/linter": "0.5.22",
29
+ "@hg-ts/types": "0.5.22",
30
30
  "@types/node": "22.19.1",
31
31
  "@vitest/coverage-v8": "4.0.14",
32
32
  "eslint": "9.18.0",
@@ -10,15 +10,17 @@ export function ExpectException(error?: AnyCLass<any, any[]>, name?: string, mes
10
10
  } catch (err: unknown) {
11
11
  isThrowError = true;
12
12
 
13
- expect(err, 'Exception type check').toBeInstanceOf(error);
13
+ if (error) {
14
+ expect(err, 'Exception type check').toBeInstanceOf(error);
15
+ }
14
16
 
15
- if (err instanceof Error) {
16
- if (name) {
17
- expect(name, 'Exception name check').toBe(name);
18
- }
19
- if (message) {
20
- expect(message, 'Exception message check').toBe(message);
21
- }
17
+ if (name) {
18
+ expect(err, 'Exception must be instance of Error to check name').toBeInstanceOf(Error);
19
+ expect((err as Error).name, 'Exception name check').toBe(name);
20
+ }
21
+ if (message) {
22
+ expect(err, 'Exception must be instance of Error to check message').toBeInstanceOf(Error);
23
+ expect((err as Error).message, 'Exception message check').toBe(message);
22
24
  }
23
25
  } finally {
24
26
  expect(isThrowError, 'Exception caught check').toBeTruthy();
package/vitest.config.mjs CHANGED
@@ -15,11 +15,14 @@ export default defineConfig({
15
15
  reporter: ['text-summary', 'text'],
16
16
  provider: 'v8',
17
17
  thresholds: {
18
- statements: 30,
19
- branches: 30,
20
- functions: 30,
21
- lines: 30,
18
+ statements: 80,
19
+ branches: 80,
20
+ functions: 80,
21
+ lines: 80,
22
22
  },
23
+ clean: true,
24
+ cleanOnRerun: true,
25
+ skipFull: true,
23
26
  watermarks: {
24
27
  statements: [80, 95],
25
28
  branches: [80, 95],
@@ -27,6 +30,7 @@ export default defineConfig({
27
30
  lines: [80, 95],
28
31
  },
29
32
  exclude: ['*/migrations/*', '*/tests/*'],
33
+ include: ['src/**/*.{ts,tsx}'],
30
34
  }
31
35
  },
32
36
  plugins: [