[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

chore: cleanup

Anthony Fu (Jan 27, 2022, 7:58 AM +0800) 5887fb7a 9cff755a

+4 -10
+1 -7
packages/vitest/src/node/config.ts
··· 1 1 import { resolve } from 'pathe' 2 - import type { ResolvedConfig as ResolvedViteConfig, UserConfig as ViteUserConfig } from 'vite' 2 + import type { ResolvedConfig as ResolvedViteConfig } from 'vite' 3 3 4 4 import type { ApiConfig, ResolvedConfig, UserConfig } from '../types' 5 5 import { defaultExclude, defaultInclude, defaultPort } from '../constants' ··· 8 8 9 9 export function resolveApiConfig<Options extends ApiConfig & UserConfig>( 10 10 options: Options, 11 - viteOverrides?: ViteUserConfig, 12 11 ): ApiConfig | undefined { 13 12 let api: ApiConfig | undefined 14 13 ··· 23 22 if (api) { 24 23 if (options.api.port) 25 24 api.port = options.api.port 26 - 27 25 if (options.api.strictPort) 28 26 api.strictPort = options.api.strictPort 29 - 30 27 if (options.api.host) 31 28 api.host = options.api.host 32 29 } ··· 38 35 if (api) { 39 36 if (!api.port) 40 37 api.port = defaultPort 41 - 42 - if (viteOverrides) 43 - viteOverrides.server = Object.assign(viteOverrides.server || {}, api) 44 38 } 45 39 46 40 return api
+3 -3
packages/vitest/src/node/plugins/index.ts
··· 1 - import type { Plugin as VitePlugin, UserConfig as ViteUserConfig } from 'vite' 1 + import type { Plugin as VitePlugin } from 'vite' 2 2 import type { UserConfig } from '../../types' 3 3 import { deepMerge, ensurePackageInstalled, notNullish } from '../../utils' 4 4 import { resolveApiConfig } from '../config' ··· 6 6 import { GlobalSetupPlugin } from './globalSetup' 7 7 import { MocksPlugin } from './mock' 8 8 9 - export async function VitestPlugin(options: UserConfig = {}, viteOverrides: ViteUserConfig = {}, ctx = new Vitest()): Promise<VitePlugin[]> { 9 + export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest()): Promise<VitePlugin[]> { 10 10 let haveStarted = false 11 11 12 12 async function UIPlugin() { ··· 20 20 enforce: 'pre', 21 21 config(viteConfig: any) { 22 22 options = deepMerge(options, viteConfig.test || {}) 23 - options.api = resolveApiConfig(options, viteOverrides) 23 + options.api = resolveApiConfig(options) 24 24 return { 25 25 clearScreen: false, 26 26 resolve: {