perf(test): run dashboard src tests in node env, app tests in jsdom

The dashboard backend (Express routes, services) lives under src/ and is pure
Node logic, but every test was paying for jsdom env init plus full CSS-import
processing. Split via environmentMatchGlobs so app/** keeps jsdom (React UI)
and src/** runs in node by default. Two src tests opt back into jsdom:

- status-bar.test.ts uses window.matchMedia.
- proxy-routes.test.ts asserts on DOMException constructor.name, which jsdom
  reports as "AbortError" but node reports as "DOMException".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-02 18:11:38 -07:00
parent 31d955c9ce
commit 488024ebfb
3 changed files with 15 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
// @vitest-environment jsdom
// Uses DOMException("Aborted", "AbortError") whose constructor.name behaves
// differently in node (resolves to "DOMException") vs jsdom ("AbortError"),
// which the proxy error classifier asserts on.
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { EventEmitter } from "node:events";
import { request, get } from "../test-request.js";

View File

@@ -1,3 +1,5 @@
// @vitest-environment jsdom
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { StatusBarManager } from "../plugins/status-bar.js";