Skip to content

viteConfig type in defineConfig is not correct #336

@FranciscoMoretti

Description

@FranciscoMoretti

Hey, thanks for creating this awesome package!

I've found that the viteConfig prop as part of defineConfig doesn't reflect the actual configuration accepted. In fact, the only property that it expects is test. However, it works anyway 👍. So I'm assuming it's a type issue.

This is the config I used. Had to add a plugin for path aliases.

import tsconfigPaths from 'vite-tsconfig-paths'

export default defineConfig({
  viteConfig: {
    // @ts-expect-error this is actually the correct way to pass vitest config
    plugins: [tsconfigPaths()],
  },
});

Here's the TS error

Object literal may only specify known properties, and 'plugins' does not exist in type '{ test?: StrictOmit<UserConfig, "mode" | "include" | "setupFiles" | "testTimeout" | "maxConcurrency" | "browser" | "config" | "watch" | "reporters" | "testNamePattern"> | undefined; }'.ts(2353)
types.d.ts(125, 9): The expected type comes from property 'viteConfig' which is declared here on type 'Config'

Version: "1.0.0-beta.8"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions