Skip to content

Commit 0192875

Browse files
committed
test(core): support vitest
1 parent 693d4aa commit 0192875

36 files changed

Lines changed: 8452 additions & 13170 deletions

angular.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
"build": {
1313
"builder": "@angular/build:ng-packagr",
1414
"options": {
15-
"tsConfig": "libs/core/tsconfig.lib.json",
1615
"project": "libs/core/ng-package.json"
1716
},
1817
"configurations": {
1918
"production": {
2019
"tsConfig": "libs/core/tsconfig.lib.prod.json"
20+
},
21+
"development": {
22+
"tsConfig": "libs/core/tsconfig.lib.json"
2123
}
2224
},
2325
"defaultConfiguration": "production"
@@ -26,7 +28,7 @@
2628
"builder": "@angular/build:unit-test",
2729
"options": {
2830
"tsConfig": "tsconfig.spec.json",
29-
"polyfills": ["zone.js", "zone.js/testing"]
31+
"runner": "vitest"
3032
}
3133
}
3234
}
@@ -40,12 +42,14 @@
4042
"build": {
4143
"builder": "@angular/build:ng-packagr",
4244
"options": {
43-
"project": "libs/components/ng-package.json",
44-
"tsConfig": "libs/components/tsconfig.lib.json"
45+
"project": "libs/components/ng-package.json"
4546
},
4647
"configurations": {
4748
"production": {
4849
"tsConfig": "libs/components/tsconfig.lib.prod.json"
50+
},
51+
"development": {
52+
"tsConfig": "libs/components/tsconfig.lib.json"
4953
}
5054
},
5155
"defaultConfiguration": "production"
@@ -54,7 +58,7 @@
5458
"builder": "@angular/build:unit-test",
5559
"options": {
5660
"tsConfig": "tsconfig.spec.json",
57-
"polyfills": ["zone.js", "zone.js/testing"]
61+
"runner": "vitest"
5862
}
5963
}
6064
}

libs/components/eslint-suppressions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
"count": 17
88
}
99
}
10-
}
10+
}

libs/components/eslint.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,12 @@ export default defineScAngularConfig(
2828
'no-undef': 'off',
2929
},
3030
},
31+
{
32+
files: ['**/*.spec.ts', '**/*.test.ts'],
33+
rules: {
34+
'@typescript-eslint/no-unsafe-member-access': 'off',
35+
'@typescript-eslint/no-unsafe-call': 'off',
36+
'@typescript-eslint/no-unsafe-return': 'off',
37+
}
38+
}
3139
)

libs/components/tsconfig.lint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"paths": {
66
"@shiftcode/ngx-core": ["../core/src/public-api.ts"]
77
},
8-
"types": ["jest", "node"]
8+
"types": ["node"]
99
}
1010
}

libs/components/tsconfig.spec.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"extends": "../../tsconfig.spec.json",
33
"compilerOptions": {
4-
"types": ["jest", "node"]
5-
}
4+
"baseUrl": "."
5+
},
6+
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
67
}

libs/core/eslint-suppressions.json

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
11
{
2-
"src/lib/http/http-date.interceptor.spec.ts": {
3-
"@typescript-eslint/no-unsafe-member-access": {
4-
"count": 2
5-
}
6-
},
7-
"src/lib/local-storage/local-storage.service.spec.ts": {
8-
"@typescript-eslint/no-unsafe-member-access": {
9-
"count": 2
10-
},
11-
"@typescript-eslint/no-unsafe-return": {
12-
"count": 1
13-
}
14-
},
152
"src/lib/logger/cloudwatch/cloud-watch.service.ts": {
163
"@typescript-eslint/no-unsafe-return": {
174
"count": 2
@@ -22,11 +9,6 @@
229
"count": 4
2310
}
2411
},
25-
"src/lib/logger/logger.service.spec.ts": {
26-
"@typescript-eslint/no-unsafe-member-access": {
27-
"count": 4
28-
}
29-
},
3012
"src/lib/static-utils/jwt-helper.ts": {
3113
"@typescript-eslint/no-unsafe-call": {
3214
"count": 2
@@ -38,21 +20,11 @@
3820
"count": 2
3921
}
4022
},
41-
"src/lib/static-utils/rxjs/filter-if-instance-of.operator.spec.ts": {
42-
"@typescript-eslint/no-unsafe-member-access": {
43-
"count": 1
44-
}
45-
},
4623
"src/lib/static-utils/rxjs/filter-if-instance-of.operator.ts": {
4724
"@typescript-eslint/no-unsafe-return": {
4825
"count": 1
4926
}
5027
},
51-
"src/lib/static-utils/rxjs/filter-if-truthy.operator.spec.ts": {
52-
"@typescript-eslint/no-unsafe-return": {
53-
"count": 1
54-
}
55-
},
5628
"src/lib/static-utils/rxjs/tap-last.operator.ts": {
5729
"@typescript-eslint/no-unsafe-call": {
5830
"count": 1
@@ -64,4 +36,4 @@
6436
"count": 1
6537
}
6638
}
67-
}
39+
}

libs/core/eslint.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ export default defineScAngularConfig(
3636
'no-undef': 'off',
3737
},
3838
},
39+
{
40+
files: ['**/*.spec.ts', '**/*.test.ts'],
41+
rules: {
42+
'@typescript-eslint/no-unsafe-member-access': 'off',
43+
'@typescript-eslint/no-unsafe-call': 'off',
44+
'@typescript-eslint/no-unsafe-return': 'off',
45+
}
46+
}
3947
)

libs/core/src/lib/http/http-date.interceptor.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { HttpTestingController, provideHttpClientTesting } from '@angular/common
99
import { ClassProvider } from '@angular/core'
1010
import { TestBed } from '@angular/core/testing'
1111
import { firstValueFrom } from 'rxjs'
12-
import { describe, it, expect, beforeEach, vi } from 'vitest'
12+
import { beforeEach, describe, expect, it, vi } from 'vitest'
1313

1414
import { HttpDateInterceptor } from './http-date.interceptor'
1515

libs/core/src/lib/local-storage/local-storage.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ClassProvider, ValueProvider } from '@angular/core'
22
import { TestBed } from '@angular/core/testing'
33
import { firstValueFrom, scan, shareReplay } from 'rxjs'
4-
import { describe, it, expect, beforeEach, vi } from 'vitest'
4+
import { beforeEach, describe, expect, it, vi } from 'vitest'
55

66
import { MockStorage } from '../../../test'
77
import { WindowRef } from '../window/window-ref.service'

libs/core/src/lib/logger/helper/leading-zero.function.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { describe, it, expect } from 'vitest'
1+
import { describe, expect,it } from 'vitest'
2+
23
import { leadingZero } from './leading-zero.function'
34

45
describe('leadingZero', () => {

0 commit comments

Comments
 (0)