Skip to content

Commit

Permalink
fix(config): ui and api regression (#820)
Browse files Browse the repository at this point in the history
* fix(ui/api): ui and api regression

The ui and the api are not started

* chore: wrong entry for port if statement

* chore: update server entries only if defined

* chore: update

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
userquin and antfu committed Feb 21, 2022
1 parent 600ca80 commit e8468d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
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

0 comments on commit e8468d2

Please sign in to comment.