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

Astro 5.0.0-alpha > 4 and Vitest fail #12007

Closed
1 task
lloydjatkinson opened this issue Sep 16, 2024 · 3 comments
Closed
1 task

Astro 5.0.0-alpha > 4 and Vitest fail #12007

lloydjatkinson opened this issue Sep 16, 2024 · 3 comments
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: server islands Related to Server Islands (scope)

Comments

@lloydjatkinson
Copy link
Contributor

lloydjatkinson commented Sep 16, 2024

Astro Info

Astro                    v5.0.0-alpha.6
Node                     v21.6.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             astro-expressive-code
                         @astrojs/tailwind
                         @astrojs/preact
                         @astrojs/react
                         @astrojs/sitemap
                         @astrojs/mdx

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

Build

Describe the Bug

Astro and Vitest fail to run as an exception is thrown. Alpha 4 works, alpha 5 and alpha 6 result in the stack trace.

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

export default getViteConfig({
});

// tried with empty config, same error.

export default getViteConfig({
    test: {
        exclude: [
            '**/node_modules/**',
            '**/integration/playwright/**'
        ],
        environment: 'jsdom', // or 'jsdom', 'node'
        alias: {
            react: 'preact/compat',
            'react-dom': 'preact/compat',
        },
    },
});
    "test:unit": "vitest run",
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯TypeError: Cannot read properties of undefined (reading 'hrefRoot')
    at createDefaultRoutes (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/astro/dist/core/routing/default.js:19:33)
    at new DevPipeline (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/astro/dist/vite-plugin-astro-server/pipeline.js:16:93)
    at DevPipeline.create (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/astro/dist/vite-plugin-astro-server/pipeline.js:42:22)
    at configureServer (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/astro/dist/vite-plugin-astro-server/plugin.js:29:36)
    at _createServer (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-CUvs3bbV.js:63019:26)
    at async createViteServer (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:9050:18)
    at async createVitest (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:10851:18)
    at async prepareVitest (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:11265:15)
    at async startVitest (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/vitest/dist/chunks/cli-api.BKkmK21J.js:11191:15)
    at async start (file:///C:/Users/Lloyd/source/repos/lloydatkinson.net/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/vitest/dist/chunks/cac.BVmpoFAv.js:1505:17)

What's the expected result?

Vitest runs correctly.

Link to Minimal Reproducible Example

https://github.com/lloydjatkinson/mre

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 Sep 16, 2024
@lloydjatkinson lloydjatkinson changed the title Astro 5.0.0-alpha.6 and Vitest fail Astro 5.0.0-alpha > 4 and Vitest fail Sep 16, 2024
@matthewp
Copy link
Contributor

Thanks, not sure why Vitest has an issue with this, but I'll take a look.

@matthewp matthewp self-assigned this Sep 16, 2024
@matthewp matthewp added feat: server islands Related to Server Islands (scope) - P4: important Violate documented behavior or significantly impacts performance (priority) and removed needs triage Issue needs to be triaged labels Sep 16, 2024
@matthewp
Copy link
Contributor

Fixed in #12009, thanks for the good report!

@lloydjatkinson
Copy link
Contributor Author

Glad to be of help! Thanks for fixing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: server islands Related to Server Islands (scope)
Projects
None yet
Development

No branches or pull requests

2 participants