2022-12-24 12:18:26 +03:00
|
|
|
import react from '@vitejs/plugin-react';
|
2022-12-24 21:17:28 +03:00
|
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
2023-05-27 12:36:18 +03:00
|
|
|
import { defineConfig } from 'vitest/config';
|
2022-12-24 21:17:28 +03:00
|
|
|
import { manifest } from './manifest';
|
2022-12-26 00:44:43 +03:00
|
|
|
import pack from './package.json';
|
2022-12-24 12:18:26 +03:00
|
|
|
|
2022-12-31 20:15:47 +03:00
|
|
|
const homepage = pack.homepage?.trim();
|
|
|
|
|
2023-02-18 13:37:49 +03:00
|
|
|
/* eslint-disable-next-line no-restricted-exports */
|
2022-12-24 12:18:26 +03:00
|
|
|
export default defineConfig({
|
2022-12-24 21:17:28 +03:00
|
|
|
plugins: [react(), VitePWA({
|
2022-12-31 18:42:04 +03:00
|
|
|
mode: process.env.NODE_ENV === 'development' ? 'development' : 'production',
|
2022-12-24 21:17:28 +03:00
|
|
|
strategies: 'injectManifest',
|
|
|
|
srcDir: './src',
|
|
|
|
filename: 'service-worker.ts',
|
|
|
|
injectRegister: false,
|
|
|
|
manifestFilename: 'manifest.json',
|
|
|
|
manifest,
|
|
|
|
})],
|
2022-12-24 12:18:26 +03:00
|
|
|
build: {
|
|
|
|
outDir: 'build',
|
|
|
|
},
|
|
|
|
server: {
|
|
|
|
port: 3000,
|
|
|
|
},
|
2022-12-31 20:15:47 +03:00
|
|
|
base: !homepage ? undefined : homepage, // Not using just homepage because empty string should be discarded
|
2023-05-27 12:36:18 +03:00
|
|
|
|
2023-05-27 14:12:38 +03:00
|
|
|
// Vitest config
|
2023-05-27 12:36:18 +03:00
|
|
|
test: {
|
|
|
|
globals: true,
|
2023-12-19 01:38:34 +03:00
|
|
|
allowOnly: true,
|
2023-05-27 12:36:18 +03:00
|
|
|
environment: 'jsdom',
|
|
|
|
setupFiles: './config/test/setupTests.ts',
|
|
|
|
coverage: {
|
2023-06-12 09:51:37 +03:00
|
|
|
provider: 'v8',
|
2023-05-27 12:36:18 +03:00
|
|
|
reporter: ['text', 'text-summary', 'html', 'clover'],
|
|
|
|
include: [
|
|
|
|
'src/**/*.{ts,tsx}',
|
|
|
|
'!src/*.{ts,tsx}',
|
|
|
|
'!src/reducers/index.ts',
|
|
|
|
'!src/**/provideServices.ts',
|
|
|
|
'!src/container/*.ts',
|
2023-06-12 09:59:38 +03:00
|
|
|
'!src/utils/helpers/sw.ts',
|
2023-05-27 12:36:18 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
// Required code coverage. Lower than this will make the check fail
|
2023-12-10 12:45:22 +03:00
|
|
|
thresholds: {
|
|
|
|
statements: 95,
|
2024-05-20 21:07:02 +03:00
|
|
|
branches: 90,
|
2023-12-10 12:45:22 +03:00
|
|
|
functions: 90,
|
|
|
|
lines: 95,
|
|
|
|
},
|
2023-05-27 12:36:18 +03:00
|
|
|
},
|
|
|
|
},
|
2022-12-24 12:18:26 +03:00
|
|
|
});
|