@salesforce/ui-bundle-template-feature-react-authentication 1.117.2

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.
Files changed (124) hide show
  1. package/LICENSE.txt +82 -0
  2. package/README.md +77 -0
  3. package/dist/.forceignore +15 -0
  4. package/dist/.husky/pre-commit +4 -0
  5. package/dist/.prettierignore +11 -0
  6. package/dist/.prettierrc +17 -0
  7. package/dist/AGENT.md +193 -0
  8. package/dist/CHANGELOG.md +2128 -0
  9. package/dist/README.md +28 -0
  10. package/dist/config/project-scratch-def.json +13 -0
  11. package/dist/eslint.config.js +7 -0
  12. package/dist/force-app/main/default/classes/UIBundleAuthUtils.cls +68 -0
  13. package/dist/force-app/main/default/classes/UIBundleAuthUtils.cls-meta.xml +5 -0
  14. package/dist/force-app/main/default/classes/UIBundleChangePassword.cls +77 -0
  15. package/dist/force-app/main/default/classes/UIBundleChangePassword.cls-meta.xml +5 -0
  16. package/dist/force-app/main/default/classes/UIBundleForgotPassword.cls +71 -0
  17. package/dist/force-app/main/default/classes/UIBundleForgotPassword.cls-meta.xml +5 -0
  18. package/dist/force-app/main/default/classes/UIBundleLogin.cls +105 -0
  19. package/dist/force-app/main/default/classes/UIBundleLogin.cls-meta.xml +5 -0
  20. package/dist/force-app/main/default/classes/UIBundleRegistration.cls +162 -0
  21. package/dist/force-app/main/default/classes/UIBundleRegistration.cls-meta.xml +5 -0
  22. package/dist/force-app/main/default/uiBundles/feature-react-authentication/.forceignore +15 -0
  23. package/dist/force-app/main/default/uiBundles/feature-react-authentication/.graphqlrc.yml +2 -0
  24. package/dist/force-app/main/default/uiBundles/feature-react-authentication/.prettierignore +9 -0
  25. package/dist/force-app/main/default/uiBundles/feature-react-authentication/.prettierrc +11 -0
  26. package/dist/force-app/main/default/uiBundles/feature-react-authentication/CHANGELOG.md +10 -0
  27. package/dist/force-app/main/default/uiBundles/feature-react-authentication/README.md +75 -0
  28. package/dist/force-app/main/default/uiBundles/feature-react-authentication/codegen.yml +95 -0
  29. package/dist/force-app/main/default/uiBundles/feature-react-authentication/components.json +18 -0
  30. package/dist/force-app/main/default/uiBundles/feature-react-authentication/e2e/app.spec.ts +17 -0
  31. package/dist/force-app/main/default/uiBundles/feature-react-authentication/eslint.config.js +169 -0
  32. package/dist/force-app/main/default/uiBundles/feature-react-authentication/feature-react-authentication.uibundle-meta.xml +7 -0
  33. package/dist/force-app/main/default/uiBundles/feature-react-authentication/index.html +12 -0
  34. package/dist/force-app/main/default/uiBundles/feature-react-authentication/package.json +70 -0
  35. package/dist/force-app/main/default/uiBundles/feature-react-authentication/playwright.config.ts +24 -0
  36. package/dist/force-app/main/default/uiBundles/feature-react-authentication/scripts/get-graphql-schema.mjs +68 -0
  37. package/dist/force-app/main/default/uiBundles/feature-react-authentication/scripts/rewrite-e2e-assets.mjs +23 -0
  38. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/api/graphqlClient.ts +25 -0
  39. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/app.tsx +16 -0
  40. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/appLayout.tsx +83 -0
  41. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/assets/icons/book.svg +3 -0
  42. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/assets/icons/copy.svg +4 -0
  43. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/assets/icons/rocket.svg +3 -0
  44. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/assets/icons/star.svg +3 -0
  45. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/assets/images/codey-1.png +0 -0
  46. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/assets/images/codey-2.png +0 -0
  47. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/assets/images/codey-3.png +0 -0
  48. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/assets/images/vibe-codey.svg +194 -0
  49. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/alerts/status-alert.tsx +49 -0
  50. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/layouts/card-layout.tsx +29 -0
  51. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/alert.tsx +76 -0
  52. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/badge.tsx +48 -0
  53. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/breadcrumb.tsx +109 -0
  54. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/button.tsx +67 -0
  55. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/calendar.tsx +232 -0
  56. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/card.tsx +103 -0
  57. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/checkbox.tsx +32 -0
  58. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/collapsible.tsx +33 -0
  59. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/datePicker.tsx +127 -0
  60. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/dialog.tsx +162 -0
  61. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/field.tsx +237 -0
  62. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/index.ts +84 -0
  63. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/input.tsx +19 -0
  64. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/label.tsx +22 -0
  65. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/pagination.tsx +132 -0
  66. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/popover.tsx +89 -0
  67. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/select.tsx +193 -0
  68. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/separator.tsx +26 -0
  69. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/skeleton.tsx +14 -0
  70. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/sonner.tsx +20 -0
  71. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/spinner.tsx +16 -0
  72. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/table.tsx +114 -0
  73. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/components/ui/tabs.tsx +88 -0
  74. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/api/userProfileApi.ts +95 -0
  75. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/authHelpers.ts +73 -0
  76. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/authenticationConfig.ts +61 -0
  77. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/context/AuthContext.tsx +95 -0
  78. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/footers/footer-link.tsx +36 -0
  79. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/forms/auth-form.tsx +81 -0
  80. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/forms/submit-button.tsx +49 -0
  81. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/hooks/form.tsx +120 -0
  82. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/hooks/useCountdownTimer.ts +266 -0
  83. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/hooks/useRetryWithBackoff.ts +109 -0
  84. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/layout/card-skeleton.tsx +38 -0
  85. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/layout/centered-page-layout.tsx +87 -0
  86. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/layouts/AuthAppLayout.tsx +12 -0
  87. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/layouts/authenticationRouteLayout.tsx +21 -0
  88. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/layouts/privateRouteLayout.tsx +44 -0
  89. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/pages/ChangePassword.tsx +107 -0
  90. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/pages/ForgotPassword.tsx +73 -0
  91. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/pages/Login.tsx +97 -0
  92. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/pages/Profile.tsx +161 -0
  93. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/pages/Register.tsx +133 -0
  94. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/pages/ResetPassword.tsx +107 -0
  95. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/sessionTimeout/SessionTimeoutValidator.tsx +602 -0
  96. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/sessionTimeout/sessionTimeService.ts +149 -0
  97. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/sessionTimeout/sessionTimeoutConfig.ts +77 -0
  98. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/features/authentication/utils/helpers.ts +121 -0
  99. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/lib/utils.ts +6 -0
  100. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/navigationMenu.tsx +80 -0
  101. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/pages/Home.tsx +12 -0
  102. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/pages/NotFound.tsx +18 -0
  103. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/router-utils.tsx +35 -0
  104. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/routes.tsx +71 -0
  105. package/dist/force-app/main/default/uiBundles/feature-react-authentication/src/styles/global.css +135 -0
  106. package/dist/force-app/main/default/uiBundles/feature-react-authentication/tsconfig.json +42 -0
  107. package/dist/force-app/main/default/uiBundles/feature-react-authentication/tsconfig.node.json +13 -0
  108. package/dist/force-app/main/default/uiBundles/feature-react-authentication/ui-bundle.json +7 -0
  109. package/dist/force-app/main/default/uiBundles/feature-react-authentication/vite-env.d.ts +1 -0
  110. package/dist/force-app/main/default/uiBundles/feature-react-authentication/vite.config.ts +106 -0
  111. package/dist/force-app/main/default/uiBundles/feature-react-authentication/vitest-env.d.ts +2 -0
  112. package/dist/force-app/main/default/uiBundles/feature-react-authentication/vitest.config.ts +11 -0
  113. package/dist/force-app/main/default/uiBundles/feature-react-authentication/vitest.setup.ts +1 -0
  114. package/dist/jest.config.js +6 -0
  115. package/dist/package-lock.json +9995 -0
  116. package/dist/package.json +40 -0
  117. package/dist/scripts/apex/hello.apex +10 -0
  118. package/dist/scripts/graphql-search.sh +191 -0
  119. package/dist/scripts/prepare-import-unique-fields.js +122 -0
  120. package/dist/scripts/setup-cli.mjs +563 -0
  121. package/dist/scripts/sf-project-setup.mjs +66 -0
  122. package/dist/scripts/soql/account.soql +6 -0
  123. package/dist/sfdx-project.json +12 -0
  124. package/package.json +44 -0
@@ -0,0 +1,135 @@
1
+ @import 'tailwindcss';
2
+
3
+ @layer base {
4
+ html,
5
+ body,
6
+ #root {
7
+ @apply min-h-screen;
8
+ }
9
+
10
+ body {
11
+ @apply antialiased bg-white;
12
+ }
13
+ }
14
+
15
+ @import 'tw-animate-css';
16
+ @import 'shadcn/tailwind.css';
17
+
18
+ @custom-variant dark (&:is(.dark *));
19
+
20
+ @theme inline {
21
+ --color-background: var(--background);
22
+ --color-foreground: var(--foreground);
23
+ --color-card: var(--card);
24
+ --color-card-foreground: var(--card-foreground);
25
+ --color-popover: var(--popover);
26
+ --color-popover-foreground: var(--popover-foreground);
27
+ --color-primary: var(--primary);
28
+ --color-primary-foreground: var(--primary-foreground);
29
+ --color-secondary: var(--secondary);
30
+ --color-secondary-foreground: var(--secondary-foreground);
31
+ --color-muted: var(--muted);
32
+ --color-muted-foreground: var(--muted-foreground);
33
+ --color-accent: var(--accent);
34
+ --color-accent-foreground: var(--accent-foreground);
35
+ --color-destructive: var(--destructive);
36
+ --color-destructive-foreground: var(--destructive-foreground);
37
+ --color-border: var(--border);
38
+ --color-input: var(--input);
39
+ --color-ring: var(--ring);
40
+ --color-chart-1: var(--chart-1);
41
+ --color-chart-2: var(--chart-2);
42
+ --color-chart-3: var(--chart-3);
43
+ --color-chart-4: var(--chart-4);
44
+ --color-chart-5: var(--chart-5);
45
+ --radius-sm: calc(var(--radius) - 4px);
46
+ --radius-md: calc(var(--radius) - 2px);
47
+ --radius-lg: var(--radius);
48
+ --radius-xl: calc(var(--radius) + 4px);
49
+ --color-sidebar: var(--sidebar);
50
+ --color-sidebar-foreground: var(--sidebar-foreground);
51
+ --color-sidebar-primary: var(--sidebar-primary);
52
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
53
+ --color-sidebar-accent: var(--sidebar-accent);
54
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
55
+ --color-sidebar-border: var(--sidebar-border);
56
+ --color-sidebar-ring: var(--sidebar-ring);
57
+ }
58
+
59
+ :root {
60
+ --radius: 0.625rem;
61
+ --background: oklch(1 0 0);
62
+ --foreground: oklch(0.145 0 0);
63
+ --card: oklch(1 0 0);
64
+ --card-foreground: oklch(0.145 0 0);
65
+ --popover: oklch(1 0 0);
66
+ --popover-foreground: oklch(0.145 0 0);
67
+ --primary: oklch(0.205 0 0);
68
+ --primary-foreground: oklch(0.985 0 0);
69
+ --secondary: oklch(0.97 0 0);
70
+ --secondary-foreground: oklch(0.205 0 0);
71
+ --muted: oklch(0.97 0 0);
72
+ --muted-foreground: oklch(0.556 0 0);
73
+ --accent: oklch(0.97 0 0);
74
+ --accent-foreground: oklch(0.205 0 0);
75
+ --destructive: oklch(0.577 0.245 27.325);
76
+ --border: oklch(0.922 0 0);
77
+ --input: oklch(0.922 0 0);
78
+ --ring: oklch(0.708 0 0);
79
+ --chart-1: oklch(0.646 0.222 41.116);
80
+ --chart-2: oklch(0.6 0.118 184.704);
81
+ --chart-3: oklch(0.398 0.07 227.392);
82
+ --chart-4: oklch(0.828 0.189 84.429);
83
+ --chart-5: oklch(0.769 0.188 70.08);
84
+ --sidebar: oklch(0.985 0 0);
85
+ --sidebar-foreground: oklch(0.145 0 0);
86
+ --sidebar-primary: oklch(0.205 0 0);
87
+ --sidebar-primary-foreground: oklch(0.985 0 0);
88
+ --sidebar-accent: oklch(0.97 0 0);
89
+ --sidebar-accent-foreground: oklch(0.205 0 0);
90
+ --sidebar-border: oklch(0.922 0 0);
91
+ --sidebar-ring: oklch(0.708 0 0);
92
+ }
93
+
94
+ .dark {
95
+ --background: oklch(0.145 0 0);
96
+ --foreground: oklch(0.985 0 0);
97
+ --card: oklch(0.205 0 0);
98
+ --card-foreground: oklch(0.985 0 0);
99
+ --popover: oklch(0.205 0 0);
100
+ --popover-foreground: oklch(0.985 0 0);
101
+ --primary: oklch(0.922 0 0);
102
+ --primary-foreground: oklch(0.205 0 0);
103
+ --secondary: oklch(0.269 0 0);
104
+ --secondary-foreground: oklch(0.985 0 0);
105
+ --muted: oklch(0.269 0 0);
106
+ --muted-foreground: oklch(0.708 0 0);
107
+ --accent: oklch(0.269 0 0);
108
+ --accent-foreground: oklch(0.985 0 0);
109
+ --destructive: oklch(0.704 0.191 22.216);
110
+ --border: oklch(1 0 0 / 10%);
111
+ --input: oklch(1 0 0 / 15%);
112
+ --ring: oklch(0.556 0 0);
113
+ --chart-1: oklch(0.488 0.243 264.376);
114
+ --chart-2: oklch(0.696 0.17 162.48);
115
+ --chart-3: oklch(0.769 0.188 70.08);
116
+ --chart-4: oklch(0.627 0.265 303.9);
117
+ --chart-5: oklch(0.645 0.246 16.439);
118
+ --sidebar: oklch(0.205 0 0);
119
+ --sidebar-foreground: oklch(0.985 0 0);
120
+ --sidebar-primary: oklch(0.488 0.243 264.376);
121
+ --sidebar-primary-foreground: oklch(0.985 0 0);
122
+ --sidebar-accent: oklch(0.269 0 0);
123
+ --sidebar-accent-foreground: oklch(0.985 0 0);
124
+ --sidebar-border: oklch(1 0 0 / 10%);
125
+ --sidebar-ring: oklch(0.556 0 0);
126
+ }
127
+
128
+ @layer base {
129
+ * {
130
+ @apply border-border outline-ring/50;
131
+ }
132
+ body {
133
+ @apply bg-background text-foreground;
134
+ }
135
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+
23
+ /* Path mapping */
24
+ "baseUrl": ".",
25
+ "paths": {
26
+ "@/*": ["./src/*"],
27
+ "@api/*": ["./src/api/*"],
28
+ "@components/*": ["./src/components/*"],
29
+ "@utils/*": ["./src/utils/*"],
30
+ "@styles/*": ["./src/styles/*"],
31
+ "@assets/*": ["./src/assets/*"]
32
+ }
33
+ },
34
+ "include": [
35
+ "src",
36
+ "e2e",
37
+ "vite-env.d.ts",
38
+ "vitest-env.d.ts",
39
+ "vitest.setup.ts"
40
+ ],
41
+ "references": [{ "path": "./tsconfig.node.json" }]
42
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
5
+ "skipLibCheck": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true,
10
+ "outDir": "./build"
11
+ },
12
+ "include": ["vite.config.ts"]
13
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "outputDir": "dist",
3
+ "routing": {
4
+ "trailingSlash": "never",
5
+ "fallback": "index.html"
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,106 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+ import path from 'path';
5
+ import { resolve } from 'path';
6
+ import tailwindcss from '@tailwindcss/vite';
7
+ import salesforce from '@salesforce/vite-plugin-ui-bundle';
8
+ import codegen from 'vite-plugin-graphql-codegen';
9
+
10
+ const schemaPath = resolve(__dirname, '../../../../../schema.graphql');
11
+ const schemaExists = existsSync(schemaPath);
12
+
13
+ export default defineConfig(({ mode }) => {
14
+ return {
15
+ base: './',
16
+ plugins: [
17
+ tailwindcss(),
18
+ react(),
19
+ salesforce(),
20
+ // Only add codegen when schema exists (e.g. after `npm run graphql:schema`).
21
+ // In CI or when schema is not checked in, skip codegen so build succeeds.
22
+ ...(schemaExists
23
+ ? [
24
+ codegen({
25
+ configFilePathOverride: resolve(__dirname, 'codegen.yml'),
26
+ runOnStart: true,
27
+ runOnBuild: true,
28
+ enableWatcher: true,
29
+ throwOnBuild: true,
30
+ }),
31
+ ]
32
+ : []),
33
+ ] as import('vite').PluginOption[],
34
+
35
+ // Build configuration for MPA
36
+ build: {
37
+ outDir: resolve(__dirname, 'dist'),
38
+ assetsDir: 'assets',
39
+ sourcemap: false,
40
+ },
41
+
42
+ // Resolve aliases (shared between build and test)
43
+ resolve: {
44
+ dedupe: ['react', 'react-dom'],
45
+ alias: {
46
+ '@': path.resolve(__dirname, './src'),
47
+ '@api': path.resolve(__dirname, './src/api'),
48
+ '@components': path.resolve(__dirname, './src/components'),
49
+ '@utils': path.resolve(__dirname, './src/utils'),
50
+ '@styles': path.resolve(__dirname, './src/styles'),
51
+ '@assets': path.resolve(__dirname, './src/assets'),
52
+ },
53
+ },
54
+
55
+ // Vitest configuration
56
+ test: {
57
+ // Override root for tests (build uses src/pages as root)
58
+ root: resolve(__dirname),
59
+
60
+ // Use jsdom environment for React component testing
61
+ environment: 'jsdom',
62
+
63
+ // Setup files to run before each test
64
+ setupFiles: ['./src/test/setup.ts'],
65
+
66
+ // Global test patterns
67
+ include: [
68
+ 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
69
+ 'src/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
70
+ ],
71
+
72
+ // Coverage configuration
73
+ coverage: {
74
+ provider: 'v8',
75
+ reporter: ['text', 'html', 'clover', 'json'],
76
+ exclude: [
77
+ 'node_modules/',
78
+ 'src/test/',
79
+ 'src/**/*.d.ts',
80
+ 'src/main.tsx',
81
+ 'src/vite-env.d.ts',
82
+ 'src/components/**/index.ts',
83
+ '**/*.config.ts',
84
+ 'build/',
85
+ 'dist/',
86
+ 'coverage/',
87
+ 'eslint.config.js',
88
+ ],
89
+ thresholds: {
90
+ global: {
91
+ branches: 85,
92
+ functions: 85,
93
+ lines: 85,
94
+ statements: 85,
95
+ },
96
+ },
97
+ },
98
+
99
+ // Test timeout
100
+ testTimeout: 10000,
101
+
102
+ // Globals for easier testing
103
+ globals: true,
104
+ },
105
+ };
106
+ });
@@ -0,0 +1,2 @@
1
+ /// <reference types="vitest" />
2
+ /// <reference types="@testing-library/jest-dom" />
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ test: {
7
+ globals: true,
8
+ environment: 'jsdom',
9
+ setupFiles: './vitest.setup.ts',
10
+ },
11
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest';
@@ -0,0 +1,6 @@
1
+ const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config');
2
+
3
+ module.exports = {
4
+ ...jestConfig,
5
+ modulePathIgnorePatterns: ['<rootDir>/.localdevserver']
6
+ };