enso/app/gui/vite.test.config.ts
Sergei Garin 3ad09a1537
Second iteration of Dashboard Fixes (#11781)
Fixes:

- Opening deleted folder
- Icons
- Diff view collapsed
- Password input for passwords in settings
- Save button appears only if form in settings is dirty
- Disable clear trash button if it's empty
- Disable D&D in the root folder
- Disable Create actions if user select a folder without sufficient permissions
- Many more
2024-12-09 20:43:41 +00:00

79 lines
2.2 KiB
TypeScript

/** @file Vite configuration for dashboard integration tests' server. */
import { fileURLToPath } from 'node:url'
import { defineConfig, mergeConfig } from 'vite'
import { loadTestEnvironmentVariables } from 'enso-common/src/appConfig'
// =====================
// === Configuration ===
// =====================
loadTestEnvironmentVariables()
// This configuration file is for dashboard tests only.
process.env.CLOUD_BUILD = 'true'
const CONFIG = (await import('./vite.config')).default
export default mergeConfig(
CONFIG,
defineConfig({
plugins: [
{
name: 'load-svg',
enforce: 'pre',
transform(_, id) {
// Mock out SVGs that are used in the dashboard.
if (id.endsWith('.svg')) {
const svgContent = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 100 100">
<defs>
<pattern id="checkerboard" width="20" height="20" patternUnits="userSpaceOnUse">
<rect width="10" height="10" fill="white"/>
<rect x="10" y="0" width="10" height="10" fill="black"/>
<rect x="0" y="10" width="10" height="10" fill="black"/>
<rect x="10" y="10" width="10" height="10" fill="white"/>
</pattern>
</defs>
<rect width="100" height="100" fill="url(#checkerboard)"/>
</svg>`
const encodedSvg = `data:image/svg+xml,${encodeURIComponent(svgContent)}`
return `export default \`${encodedSvg}\``
}
},
},
],
resolve: {
alias: {
'@stripe/stripe-js/pure': fileURLToPath(
new URL('./integration-test/dashboard/mock/stripe.ts', import.meta.url),
),
'@stripe/react-stripe-js': fileURLToPath(
new URL('./integration-test/dashboard/mock/react-stripe.tsx', import.meta.url),
),
},
extensions: [
'.mock.mjs',
'.mock.js',
'.mock.mts',
'.mock.ts',
'.mock.jsx',
'.mock.tsx',
'.mock.json',
'.mjs',
'.js',
'.mts',
'.ts',
'.jsx',
'.tsx',
'.json',
],
},
define: {
'process.env.IS_IN_PLAYWRIGHT_TEST': JSON.stringify(`${true}`),
},
build: {
outDir: fileURLToPath(new URL('./mockDist', import.meta.url)),
},
}),
)