Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Test environment detection doesn't consider Vitest workspaces

未關閉 適合新手
#205 1 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
typescript, vite
領域
testing-qa

研究方向

從 src/index.ts 的第 213-224 行開始,將 plugin 對測試環境的偵測與所連結重現中的 test.workspace 設定進行比較。檢查是否正確支援以 workspace 為基礎的環境,以及 vite.config.ts 中的 workaround 是否已不再需要,同時避免重複提示安裝 jsdom。

由索引模型根據 Issue 內容生成。

描述

Hello! I am integrating the new Vitest Browser mode into a project using Solid. Their guide suggests that if you want to use it alongside other test environments, you should configure it using workspaces.

The Solid Vite plugin does not appear to read the user test.workspace configuration and defaults to jsdom.

// ...
      const userTest = (userConfig as any).test ?? {};
      const test = {} as any;
      if (userConfig.mode === 'test') {
        // ...
        if (!userTest.environment && !options.ssr) {
          test.environment = 'jsdom';
        }
// ...

Which results on being prompted to install jsdom each time

Image

Reproduction

I made a quick reproduction here.

Workaround

My current workaround is to do this on my vite.config.ts:

import { defineConfig } from "vite"
import solid from "vite-plugin-solid"
import tsConfigPaths from "vite-tsconfig-paths"

export default defineConfig({
  plugins: [tsConfigPaths(), solid()],
  test: {
    // Workaround for Solid Vite plugin. Get's superseeded by `workspace` config
    environment: "node",
    workspace: [
      {
        extends: true,
        test: {
          include: ["**/*.test.{ts,tsx}"],
          name: "Node.js",
          environment: "node",
        },
      },
      {
        extends: true,
        test: {
          include: ["**/*.test.dom.{ts,tsx}"],
          browser: {
            enabled: true,
            headless: true,
            ui: false,
            provider: "playwright",
            instances: [
              {
                browser: "chromium",
                name: "DOM",
              },
            ],
          },
        },
      },
    ],
  },
})

Could the Solid Vite plugin also check the user test.workspace configuration? 🙂 I can draft a PR if the request makes sense

主要語言
TypeScript
星號
520
分支
70
平均合併
19 小時 26 分鐘
30 天內合併 PR
35

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

solidjs/solid-vite-plugin 的其他 Issue

查看 solidjs/solid-vite-plugin 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。