jan/web-app/vitest.config.ts
Dinh Long Nguyen a30eb7f968
feat: Jan Web (reusing Jan Desktop UI) (#6298)
* add platform guards

* add service management

* fix types

* move to zustand for servicehub

* update App Updater

* update tauri missing move

* update app updater

* refactor: move PlatformFeatures to separate const file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* change tauri fetch name

* update implementation

* update extension fetch

* make web version run properly

* disabled unused web settings

* fix all tests

* fix lint

* fix tests

* add mock for extension

* fix build

* update make and mise

* fix tsconfig for web-extensions

* fix loader type

* cleanup

* fix test

* update error handling + mcp should be working

* Update mcp init

* use separate is_web_app build property

* Remove fixed model catalog url

* fix additional tests

* fix download issue (event emitter not implemented correctly)

* Update Title html

* fix app logs

* update root tsx render timing

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-05 01:47:46 +07:00

56 lines
1.6 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import path from 'path'
export default defineConfig({
plugins: [react()],
test: {
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
globals: true,
css: true,
coverage: {
reporter: ['text', 'json', 'html', 'lcov'],
include: ['src/**/*.{ts,tsx}'],
exclude: [
'node_modules/',
'dist/',
'coverage/',
'src/**/*.test.ts',
'src/**/*.test.tsx',
'src/test/**/*',
],
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
// Provide a fallback for @jan/extensions-web when it doesn't exist (CICD desktop builds)
'@jan/extensions-web': (() => {
try {
// Try to resolve the actual package first
require.resolve('@jan/extensions-web')
return '@jan/extensions-web'
} catch {
// If package doesn't exist, use a mock
return path.resolve(__dirname, './src/test/mocks/extensions-web.ts')
}
})(),
},
},
define: {
IS_TAURI: JSON.stringify('false'),
IS_WEB_APP: JSON.stringify('false'),
IS_MACOS: JSON.stringify('false'),
IS_WINDOWS: JSON.stringify('false'),
IS_LINUX: JSON.stringify('false'),
IS_IOS: JSON.stringify('false'),
IS_ANDROID: JSON.stringify('false'),
PLATFORM: JSON.stringify('web'),
VERSION: JSON.stringify('test'),
POSTHOG_KEY: JSON.stringify(''),
POSTHOG_HOST: JSON.stringify(''),
AUTO_UPDATER_DISABLED: JSON.stringify('false'),
},
})