password_manager/vite.config.js
hermes-explorigin 8652dab880
All checks were successful
Test, Build & Deploy / test-and-build (push) Successful in 1m36s
Test, Build & Deploy / deploy (push) Successful in 20s
Bump vitest testTimeout to 30s for slow PBKDF2 (600k iters) derivations
The crypto suite's deriveKey tests exceeded vitest's default 5s per-test
timeout in CI (passed locally only because the host is faster). Set a 30s
per-test timeout so the PBKDF2-heavy tests don't flake the pipeline.
2026-08-30 19:15:06 +00:00

51 lines
1.4 KiB
JavaScript

import { execSync } from 'node:child_process'
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { viteSingleFile } from 'vite-plugin-singlefile'
// https://vite.dev/config/
// Bake the commit hash into the bundle at build time so a deployed app can
// report exactly which commit produced it (logged via console.info at startup).
// CI sets VITE_COMMIT_HASH=${{ github.sha }}; local builds fall back to git HEAD.
function getCommitHash() {
if (process.env.VITE_COMMIT_HASH) return process.env.VITE_COMMIT_HASH
try {
return execSync('git rev-parse HEAD').toString().trim()
} catch {
return 'unknown'
}
}
export default defineConfig(({ command }) => ({
define: {
__VAULT_COMMIT__: JSON.stringify(getCommitHash()),
},
plugins: [
svelte(),
...(command === 'build'
? [viteSingleFile({
inlineStyles: true,
inlineScripts: true,
removeUnusedCss: true,
removeViteModuleLoader: true,
})]
: []),
],
build: {
target: 'esnext',
minify: false,
},
preview: {
allowedHosts: ["dev.thecookiejar.me"]
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./tests/setup.js'],
include: ['src/**/*.test.js', 'tests/**/*.test.js'],
// PBKDF2 (600k iterations) derivations are slow; don't let the default 5s
// per-test timeout flake the suite on slower CI hosts.
testTimeout: 30000,
},
}))