Skip to content

Configuration for vitest not assignable to type UserConfig #8768

@Beiri22

Description

@Beiri22

Describe the bug

There seems to be some configuration deficiency. See below.

Reproduction

Create a standard sveltekit project including vitest.

You get a vite.config like:

import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';

const config: UserConfig = {
	plugins: [sveltekit()],
	test: {
		include: ['src/**/*.{test,spec}.{js,ts}']
	}
};

export default config;

running npm run check states the problem:

Error: Type '{ plugins: Promise<Plugin_2[]>[]; test: { include: string[]; }; }' is not assignable to type 'UserConfig'.
  Object literal may only specify known properties, and 'test' does not exist in type 'UserConfig'. 
        plugins: [sveltekit()],
        test: {
                include: ['src/**/*.{test,spec}.{js,ts}']
        }
};

Logs

No response

System Info

System:
    OS: Linux 6.2 Manjaro Linux
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 25.43 GB / 31.27 GB
    Container: Yes
    Shell: 3.6.0 - /usr/bin/fish
  Binaries:
    Node: 19.4.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 8.19.2 - /usr/bin/npm
  Browsers:
    Chromium: 109.0.5414.119
    Firefox: 109.0
  npmPackages:
    @sveltejs/adapter-node: ^1.0.0 => 1.1.4 
    @sveltejs/kit: ^1.0.0 => 1.3.2 
    svelte: ^3.54.0 => 3.55.1 
    vite: ^4.0.0 => 4.0.4

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions