@salesforce/templates 65.5.9 → 65.5.11

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.
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfigFnObject;
2
+ export default _default;
@@ -0,0 +1,74 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import path from 'path';
4
+ import { resolve } from 'path';
5
+ import tailwindcss from '@tailwindcss/vite';
6
+ import salesforce from '@salesforce/vite-plugin-webapp-experimental';
7
+ export default defineConfig(function (_a) {
8
+ var mode = _a.mode;
9
+ return {
10
+ plugins: [tailwindcss(), react(), salesforce()],
11
+ // Build configuration for MPA
12
+ build: {
13
+ outDir: resolve(__dirname, 'dist'),
14
+ assetsDir: 'assets',
15
+ sourcemap: false,
16
+ },
17
+ // Resolve aliases (shared between build and test)
18
+ resolve: {
19
+ dedupe: ['react', 'react-dom'],
20
+ alias: {
21
+ '@': path.resolve(__dirname, './src'),
22
+ '@api': path.resolve(__dirname, './src/api'),
23
+ '@components': path.resolve(__dirname, './src/components'),
24
+ '@utils': path.resolve(__dirname, './src/utils'),
25
+ '@styles': path.resolve(__dirname, './src/styles'),
26
+ '@assets': path.resolve(__dirname, './src/assets'),
27
+ },
28
+ },
29
+ // Vitest configuration
30
+ test: {
31
+ // Override root for tests (build uses src/pages as root)
32
+ root: resolve(__dirname),
33
+ // Use jsdom environment for React component testing
34
+ environment: 'jsdom',
35
+ // Setup files to run before each test
36
+ setupFiles: ['./src/test/setup.ts'],
37
+ // Global test patterns
38
+ include: [
39
+ 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
40
+ 'src/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',
41
+ ],
42
+ // Coverage configuration
43
+ coverage: {
44
+ provider: 'v8',
45
+ reporter: ['text', 'html', 'clover', 'json'],
46
+ exclude: [
47
+ 'node_modules/',
48
+ 'src/test/',
49
+ 'src/**/*.d.ts',
50
+ 'src/main.tsx',
51
+ 'src/vite-env.d.ts',
52
+ 'src/components/**/index.ts',
53
+ '**/*.config.ts',
54
+ 'build/',
55
+ 'dist/',
56
+ 'coverage/',
57
+ 'eslint.config.js',
58
+ ],
59
+ thresholds: {
60
+ global: {
61
+ branches: 85,
62
+ functions: 85,
63
+ lines: 85,
64
+ statements: 85,
65
+ },
66
+ },
67
+ },
68
+ // Test timeout
69
+ testTimeout: 10000,
70
+ // Globals for easier testing
71
+ globals: true,
72
+ },
73
+ };
74
+ });
@@ -0,0 +1,24 @@
1
+ import { test, expect } from '@playwright/test';
2
+
3
+ test.describe('base-react-app', () => {
4
+ test('home page loads and shows welcome content', async ({ page }) => {
5
+ await page.goto('/');
6
+ await expect(page.getByRole('heading', { name: 'Home' })).toBeVisible();
7
+ await expect(
8
+ page.getByText('Welcome to your React application.')
9
+ ).toBeVisible();
10
+ });
11
+
12
+ test('about page loads', async ({ page }) => {
13
+ await page.goto('/about');
14
+ await expect(page).toHaveURL(/\/about/);
15
+ await expect(page.getByRole('heading', { name: 'About' })).toBeVisible();
16
+ await expect(page.getByText('This is the about page.')).toBeVisible();
17
+ });
18
+
19
+ test('not found route shows 404', async ({ page }) => {
20
+ await page.goto('/non-existent-route');
21
+ await expect(page.getByRole('heading', { name: '404' })).toBeVisible();
22
+ await expect(page.getByText('Page not found')).toBeVisible();
23
+ });
24
+ });