Skip to content

Commit

Permalink
chore: improve some typedefs
Browse files Browse the repository at this point in the history
  • Loading branch information
javastation committed Jun 22, 2021
1 parent 9d5ac00 commit ac2506d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/jestPerTestSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
build,
ViteDevServer,
UserConfig,
PluginOption
PluginOption,
ResolvedConfig
} from 'vite'
import { Page } from 'playwright-chromium'
// eslint-disable-next-line node/no-extraneous-import
Expand Down Expand Up @@ -109,15 +110,16 @@ beforeAll(async () => {
} else {
process.env.VITE_INLINE = 'inline-build'
// determine build watch
let isWatch = false
let resolvedConfig: ResolvedConfig
const resolvedPlugin: () => PluginOption = () => ({
name: 'vite-plugin-watcher',
configResolved(resolvedConfig) {
isWatch = !!resolvedConfig.build?.watch
configResolved(config) {
resolvedConfig = config
}
})
options.plugins = [resolvedPlugin()]
const rollupOutput = await build(options)
const isWatch = !!resolvedConfig!.build.watch
// in build watch,call startStaticServer after the build is complete
if (isWatch) {
global.watcher = rollupOutput as RollupWatcher
Expand Down

0 comments on commit ac2506d

Please sign in to comment.