Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): ui and api regression #820

Merged
merged 4 commits into from Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/ui/client/auto-imports.d.ts
Expand Up @@ -42,6 +42,7 @@ declare global {
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onKeyStroke: typeof import('@vueuse/core')['onKeyStroke']
const onLongPress: typeof import('@vueuse/core')['onLongPress']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
Expand Down Expand Up @@ -88,6 +89,7 @@ declare global {
const useBreakpoints: typeof import('@vueuse/core')['useBreakpoints']
const useBroadcastChannel: typeof import('@vueuse/core')['useBroadcastChannel']
const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
const useCached: typeof import('@vueuse/core')['useCached']
const useClamp: typeof import('@vueuse/core')['useClamp']
const useClipboard: typeof import('@vueuse/core')['useClipboard']
const useColorMode: typeof import('@vueuse/core')['useColorMode']
Expand Down Expand Up @@ -125,6 +127,7 @@ declare global {
const useFullscreen: typeof import('@vueuse/core')['useFullscreen']
const useGeolocation: typeof import('@vueuse/core')['useGeolocation']
const useIdle: typeof import('@vueuse/core')['useIdle']
const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']
const useIntersectionObserver: typeof import('@vueuse/core')['useIntersectionObserver']
const useInterval: typeof import('@vueuse/core')['useInterval']
const useIntervalFn: typeof import('@vueuse/core')['useIntervalFn']
Expand All @@ -145,6 +148,7 @@ declare global {
const useNavigatorLanguage: typeof import('@vueuse/core')['useNavigatorLanguage']
const useNetwork: typeof import('@vueuse/core')['useNetwork']
const useNow: typeof import('@vueuse/core')['useNow']
const useOffsetPagination: typeof import('@vueuse/core')['useOffsetPagination']
const useOnline: typeof import('@vueuse/core')['useOnline']
const usePageLeave: typeof import('@vueuse/core')['usePageLeave']
const useParallax: typeof import('@vueuse/core')['useParallax']
Expand Down
4 changes: 2 additions & 2 deletions packages/vitest/src/node/plugins/index.ts
Expand Up @@ -24,7 +24,7 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest())
// preliminary merge of options to be able to create server options for vite
// however to allow vitest plugins to modify vitest config values
// this is repeated in configResolved where the config is final
const preOptions = deepMerge({}, options, viteConfig.test ?? {})
const preOptions = deepMerge({}, configDefaults, options, viteConfig.test ?? {})
preOptions.api = resolveApiConfig(preOptions)

// store defines for globalThis to make them
Expand Down Expand Up @@ -110,7 +110,7 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest())
await ctx.report('onServerRestart')
await ctx.setServer(options, server)
haveStarted = true
if (options.api)
if (options.api && options.watch)
(await import('../../api/setup')).setup(ctx)

// #415, in run mode we don't need the watcher, close it would improve the performance
Expand Down
14 changes: 12 additions & 2 deletions packages/vitest/src/node/reporters/base.ts
Expand Up @@ -25,10 +25,20 @@ export abstract class BaseReporter implements Reporter {

onInit(ctx: Vitest) {
this.ctx = ctx

this.ctx.log()

const mode = this.ctx.config.watch
? c.blue(' WATCH ')
? c.blue(' DEV ')
: c.cyan(' RUN ')
this.ctx.log(`\n${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}\n`)
this.ctx.log(`${c.inverse(c.bold(mode))} ${c.gray(this.ctx.config.root)}`)

if (this.ctx.config.ui)
this.ctx.log(c.green(` Vitest UI started at http://${this.ctx.config.api?.host || 'localhost'}:${c.bold(`${this.ctx.server.config.server.port}`)}`))
else if (this.ctx.config.api)
this.ctx.log(c.green(` Vitest API started at http://${this.ctx.config.api?.host || 'localhost'}:${c.bold(`${this.ctx.config.api.port}`)}`))

this.ctx.log()
this.start = performance.now()
}

Expand Down