Skip to content

Commit

Permalink
fix(ct): use correct type for config from vite
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed Jun 9, 2024
1 parent 016dc45 commit b152038
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/runner/browser-env/vite/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { plugin as generateIndexHtml } from "./plugins/generate-index-html";
import { Config } from "../../../config";
import { VITE_DEFAULT_CONFIG_ENV } from "./constants";

import type { ViteDevServer, InlineConfig } from "vite";
import type { ViteDevServer, UserConfig, InlineConfig } from "vite";
import type { BrowserTestRunEnvOptions } from "./types";

export class ViteServer {
Expand Down Expand Up @@ -87,10 +87,10 @@ export class ViteServer {
}

const config = this._options.viteConfig;
let preparedConfig: InlineConfig;
let preparedConfig: UserConfig;

if (_.isString(config)) {
preparedConfig = (await import(path.resolve(process.cwd(), config))).default as InlineConfig;
preparedConfig = (await import(path.resolve(process.cwd(), config))).default as UserConfig;
} else if (_.isFunction(config)) {
preparedConfig = await config(VITE_DEFAULT_CONFIG_ENV);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/runner/browser-env/vite/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { BROWSER_EVENT_PREFIX } from "./constants";
import type { InlineConfig, ConfigEnv } from "vite";
import type { UserConfig, ConfigEnv } from "vite";
import type { BrowserViteEvents, WorkerViteEvents, ViteBrowserEvents } from "./browser-modules/types";

export type { BrowserViteEvents, WorkerViteEvents } from "./browser-modules/types";

export interface BrowserTestRunEnvOptions {
viteConfig?: string | InlineConfig | ((env: ConfigEnv) => InlineConfig | Promise<InlineConfig>);
viteConfig?: string | UserConfig | ((env: ConfigEnv) => UserConfig | Promise<UserConfig>);
}

export interface ClientViteEvents extends BrowserViteEvents, WorkerViteEvents {}
Expand Down

0 comments on commit b152038

Please sign in to comment.