Skip to content

Commit 90de48a

Browse files
authored
[angular] add vitest support (jhipster#31135)
1 parent bb09e76 commit 90de48a

File tree

100 files changed

+640
-282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+640
-282
lines changed

.blueprint/generate-sample/templates/test-integration/jdl-samples/ms-mf-ng-consul-oauth2-neo4j/blog-store.jdl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ application {
2525
baseName gateway
2626
buildTool maven
2727
clientFramework angular
28+
clientTestFramework vitest
2829
creationTimestamp 1617901618886
2930
databaseMigration liquibase
3031
databaseType neo4j
@@ -46,6 +47,7 @@ application {
4647
buildTool maven
4748
cacheProvider no
4849
clientFramework angular
50+
clientTestFramework vitest
4951
creationTimestamp 1617901618887
5052
databaseType neo4j
5153
jwtSecretKey "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ="
@@ -88,6 +90,7 @@ application {
8890
baseName notification,
8991
buildTool gradle
9092
clientFramework angular
93+
clientTestFramework vitest
9194
creationTimestamp 1617901618889
9295
databaseType neo4j
9396
dtoSuffix Rest

.blueprint/generate-sample/templates/test-integration/samples/webflux-gradle-session-h2mem-es/.yo-rc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"cacheProvider": "no",
88
"clientBundler": "webpack",
99
"clientFramework": "angular",
10+
"clientTestFramework": "vitest",
1011
"creationTimestamp": 1596513272473,
1112
"databaseType": "sql",
1213
"devDatabaseType": "h2Memory",

.blueprint/generate-sample/templates/test-integration/samples/webflux-mongodb-oauth2/.yo-rc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"cacheProvider": "no",
88
"clientBundler": "webpack",
99
"clientFramework": "angular",
10+
"clientTestFramework": "vitest",
1011
"clientTheme": "none",
1112
"creationTimestamp": 1580314672693,
1213
"databaseType": "mongodb",

.blueprint/generate-sample/templates/test-integration/samples/webflux-psql/.yo-rc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"cacheProvider": "no",
88
"clientBundler": "webpack",
99
"clientFramework": "angular",
10+
"clientTestFramework": "vitest",
1011
"creationTimestamp": 1596513172471,
1112
"databaseType": "sql",
1213
"devDatabaseType": "h2Disk",

.blueprint/generate-sample/templates/test-integration/workflow-samples/angular.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"app-sample": "ng-default",
1414
"jdl-entity": "*",
1515
"generatorOptions": {
16+
"clientTestFramework": "vitest",
1617
"clientBundler": "webpack"
1718
}
1819
},

.blueprint/github-build-matrix/__snapshots__/generator.spec.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ exports[`generator - github-build-matrix with angular should match matrix value
4141
"app-sample": "ng-default",
4242
"jdl-entity": "*",
4343
"generatorOptions": {
44+
"clientTestFramework": "vitest",
4445
"clientBundler": "webpack"
4546
},
4647
"workspaces": "false",

generators/angular/files-angular.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,25 @@ export const files = asWriteFilesSection({
3636
'tsconfig.json',
3737
'tsconfig.app.json',
3838
'tsconfig.spec.json',
39-
'jest.conf.js',
4039
],
4140
}),
4241
clientRootTemplatesBlock({
4342
condition: ctx => ctx.enableTranslation && ctx.enableI18nRTL,
4443
templates: ['postcss.config.json'],
4544
}),
4645
],
46+
jest: [
47+
clientRootTemplatesBlock({
48+
condition: ctx => ctx.clientTestFrameworkJest,
49+
templates: ['jest.conf.js'],
50+
}),
51+
],
52+
vitest: [
53+
clientSrcTemplatesBlock({
54+
condition: ctx => ctx.clientTestFrameworkVitest,
55+
templates: ['default-test-providers.ts'],
56+
}),
57+
],
4758
webpack: [
4859
clientRootTemplatesBlock({
4960
condition: ctx => ctx.clientBundlerWebpack,

generators/angular/generators/bootstrap/__snapshots__/generator.spec.ts.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ exports[`generator - angular:bootstrap bootstrapping default config should prepa
6565
"clientSrcDir": "src/main/webapp/",
6666
"clientTestDir": "src/test/javascript/",
6767
"clientTestFramework": "jest",
68+
"clientTestFrameworkAny": true,
69+
"clientTestFrameworkJest": true,
6870
"clientTestFrameworkName": "Jest",
71+
"clientTestFrameworkVitest": false,
6972
"clientTestFrameworks": undefined,
7073
"clientTestFrameworksAny": false,
7174
"clientTestFrameworksCypress": false,

generators/angular/generators/bootstrap/generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default class BootstrapGenerator extends AngularApplicationGenerator {
7474
createNeedleCallback({
7575
needle: 'i18n-language-loader',
7676
contentToAdd: allLanguages.map(
77-
lang => `'${lang.languageTag}': async (): Promise<any> => import('i18n/${lang.languageTag}.json'),`,
77+
lang => `'${lang.languageTag}': async (): Promise<any> => import('i18n/${lang.languageTag}.json').catch(),`,
7878
),
7979
}),
8080
createNeedleCallback({

generators/angular/resources/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@
4545
"jest-junit": "16.0.0",
4646
"jest-preset-angular": "14.6.0",
4747
"jest-sonar": "0.2.16",
48+
"jsdom": "27.0.1",
4849
"merge-jsons-webpack-plugin": "2.0.1",
4950
"postcss-rtlcss": "5.7.1",
5051
"rimraf": "5.0.8",
5152
"tinyglobby": "0.2.15",
5253
"ts-jest": "29.4.5",
5354
"typescript": "5.9.2",
5455
"typescript-eslint": "8.46.2",
56+
"vitest": "3.2.4",
57+
"vitest-sonar-reporter": "2.0.4",
5558
"webpack": "5.102.1",
5659
"webpack-bundle-analyzer": "4.10.2",
5760
"webpack-merge": "6.0.1",

0 commit comments

Comments
 (0)