mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:29:32 -05:00 
			
		
		
		
	* Updated vite and ts config file with vtest options and a new alias to fix the dev command error * Updated package script and update the packages -- this removes jest dependencies * Added new setup file needed in vitest in order to be able to use the jest-dom matchers in tests * Updated deprecated utilities when using faker * Updated test files and mocks to use vitest instead of jest * Enabled web test check in GitHub actions * remove babel dependencies as they are no longer needed with vitest * move the jest config files to a folder in case we need to go back to jest * chore: remove old files --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import { sveltekit } from '@sveltejs/kit/vite';
 | 
						|
import path from 'path';
 | 
						|
 | 
						|
const upstream = {
 | 
						|
  target: process.env.IMMICH_SERVER_URL || 'http://immich-server:3001/',
 | 
						|
  secure: true,
 | 
						|
  changeOrigin: true,
 | 
						|
  logLevel: 'info',
 | 
						|
  ws: true,
 | 
						|
};
 | 
						|
 | 
						|
/** @type {import('vite').UserConfig} */
 | 
						|
const config = {
 | 
						|
  resolve: {
 | 
						|
    alias: {
 | 
						|
      'xmlhttprequest-ssl': './node_modules/engine.io-client/lib/xmlhttprequest.js',
 | 
						|
      '@test-data': path.resolve(__dirname, './src/test-data'),
 | 
						|
      '@api': path.resolve('./src/api'),
 | 
						|
    },
 | 
						|
  },
 | 
						|
  server: {
 | 
						|
    // connect to a remote backend during web-only development
 | 
						|
    proxy: {
 | 
						|
      '/api': upstream,
 | 
						|
      '/.well-known/immich': upstream,
 | 
						|
      '/custom.css': upstream,
 | 
						|
    },
 | 
						|
  },
 | 
						|
  plugins: [sveltekit()],
 | 
						|
  optimizeDeps: {
 | 
						|
    entries: ['src/**/*.{svelte,ts,html}'],
 | 
						|
  },
 | 
						|
};
 | 
						|
 | 
						|
/** @type {import('vitest').UserConfig} */
 | 
						|
const test = {
 | 
						|
  include: ['src/**/*.{test,spec}.{js,ts}'],
 | 
						|
  globals: true,
 | 
						|
  environment: 'jsdom',
 | 
						|
  setupFiles: ['./src/test-data/setup.ts'],
 | 
						|
  sequence: {
 | 
						|
    hooks: 'list',
 | 
						|
  },
 | 
						|
  alias: [{ find: /^svelte$/, replacement: 'svelte/internal' }],
 | 
						|
};
 | 
						|
 | 
						|
export default { ...config, test };
 |