Test environment detection doesn't consider Vitest workspaces
維護者通常 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
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
環境準備
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
solidjs/solid-vite-plugin 的其他 Issue
-
難度 3/5 1-2 天 新手友好度 76/100
solidjs/solid-vite-plugin#375 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 68/100
solidjs/solid-vite-plugin#369 · 3 則留言 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 35/100
solidjs/solid-vite-plugin#328 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 68/100
solidjs/solid-vite-plugin#308 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 72/100
solidjs/solid-vite-plugin#262 · 2 則留言 ·
維護者通常 1 天內回覆
查看 solidjs/solid-vite-plugin 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
rohitg00/agentmemory#1428 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 86/100
boxlite-ai/boxlite#1729 ·
維護者通常 1 天內回覆
-
detectors enhancement good first issue
難度 2/5 1-3 小時 新手友好度 86/100
SM260845/readme-gen#1 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
angular/angularfire#3774 ·
維護者通常 2 天內回覆