Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vitest is broken in Astro v5 #12723

Closed
1 task
sarthikg opened this issue Dec 12, 2024 · 4 comments
Closed
1 task

Vitest is broken in Astro v5 #12723

sarthikg opened this issue Dec 12, 2024 · 4 comments
Labels
needs repro Issue needs a reproduction

Comments

@sarthikg
Copy link

Astro Info

Astro                    v5.0.4
Node                     v20.13.1
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/vercel
Integrations             @astrojs/sitemap
                         @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

As per the (docs)[https://docs.astro.build/en/guides/testing/#vitest], configuring Vitest in Astro can be done by creating a vitest.config.ts file, with the following contents:

/// <reference types="vitest" />
import { getViteConfig } from "astro/config";

export default getViteConfig({
  test: {
     // Config Variables
  },
});

Though, after upgrading to Astro v5, this doesn't seem to be working anymore. The build is failing, as well as execution of tests are failing.

Error is as follows:

vitest.config.ts:5:3 - error ts(2353): Object literal may only specify known properties, and 'test' does not exist in type 'UserConfig'.

What's the expected result?

The tests & build should be run.

Link to Minimal Reproducible Example

sarthikg/portfolio#255

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 12, 2024
@ematipico ematipico added the needs repro Issue needs a reproduction label Dec 12, 2024
Copy link
Contributor

Hello @sarthikg. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Dec 12, 2024
@ematipico
Copy link
Member

Please provide a minimal reproduction, a project isn't acceptable

@ArmandPhilippot
Copy link
Contributor

Hi @sarthikg, I think this is similar to #12662.

To resume: Vitest is not yet(/longer) compatible with Vite v6, so there are conflicts right now. In the meantime, I think the workaround in #12662 should work for you too.

@ascorbic
Copy link
Contributor

Closing as a duplicate of #12662. It's correct that this is related to Vitest not working properly with Vite 6. There is more info in this issue: vitest-dev/vitest#6992

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue needs a reproduction
Projects
None yet
Development

No branches or pull requests

4 participants