mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-21 05:32:53 +00:00
test: align ui vitest configs with thread policy
This commit is contained in:
@@ -163,7 +163,7 @@ describe("scoped vitest configs", () => {
|
||||
|
||||
it("defaults channel tests to non-isolated mode", () => {
|
||||
expect(defaultChannelsConfig.test?.isolate).toBe(false);
|
||||
expect(defaultChannelsConfig.test?.pool).toBe("forks");
|
||||
expect(defaultChannelsConfig.test?.pool).toBe("threads");
|
||||
});
|
||||
|
||||
it("keeps the core channel lane limited to non-extension roots", () => {
|
||||
@@ -199,7 +199,7 @@ describe("scoped vitest configs", () => {
|
||||
|
||||
it("defaults extension tests to non-isolated mode", () => {
|
||||
expect(defaultExtensionsConfig.test?.isolate).toBe(false);
|
||||
expect(defaultExtensionsConfig.test?.pool).toBe("forks");
|
||||
expect(defaultExtensionsConfig.test?.pool).toBe("threads");
|
||||
});
|
||||
|
||||
it("normalizes extension channel include patterns relative to the scoped dir", () => {
|
||||
|
||||
23
test/vitest-ui-package-config.test.ts
Normal file
23
test/vitest-ui-package-config.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import uiConfig from "../ui/vitest.config.ts";
|
||||
import uiNodeConfig from "../ui/vitest.node.config.ts";
|
||||
|
||||
describe("ui package vitest config", () => {
|
||||
it("keeps the standalone ui package on threads and isolate=false", () => {
|
||||
expect(uiConfig.test?.pool).toBe("threads");
|
||||
expect(uiConfig.test?.isolate).toBe(false);
|
||||
expect(uiConfig.test?.projects).toHaveLength(3);
|
||||
|
||||
for (const project of uiConfig.test?.projects ?? []) {
|
||||
expect(project.test?.pool).toBe("threads");
|
||||
expect(project.test?.isolate).toBe(false);
|
||||
expect(project.test?.runner).toBe("../test/non-isolated-runner.ts");
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps the standalone ui node config on threads and isolate=false", () => {
|
||||
expect(uiNodeConfig.test?.pool).toBe("threads");
|
||||
expect(uiNodeConfig.test?.isolate).toBe(false);
|
||||
expect(uiNodeConfig.test?.runner).toBe("../test/non-isolated-runner.ts");
|
||||
});
|
||||
});
|
||||
@@ -1,12 +1,20 @@
|
||||
import { playwright } from "@vitest/browser-playwright";
|
||||
import { defineConfig, defineProject } from "vitest/config";
|
||||
import { jsdomOptimizedDeps } from "../vitest.shared.config.ts";
|
||||
import { jsdomOptimizedDeps, resolveDefaultVitestPool } from "../vitest.shared.config.ts";
|
||||
|
||||
const sharedUiTestConfig = {
|
||||
isolate: false,
|
||||
pool: resolveDefaultVitestPool(),
|
||||
runner: "../test/non-isolated-runner.ts",
|
||||
} as const;
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
...sharedUiTestConfig,
|
||||
projects: [
|
||||
defineProject({
|
||||
test: {
|
||||
...sharedUiTestConfig,
|
||||
deps: jsdomOptimizedDeps,
|
||||
name: "unit",
|
||||
include: ["src/**/*.test.ts"],
|
||||
@@ -17,6 +25,7 @@ export default defineConfig({
|
||||
}),
|
||||
defineProject({
|
||||
test: {
|
||||
...sharedUiTestConfig,
|
||||
deps: jsdomOptimizedDeps,
|
||||
name: "unit-node",
|
||||
include: ["src/**/*.node.test.ts"],
|
||||
@@ -26,6 +35,7 @@ export default defineConfig({
|
||||
}),
|
||||
defineProject({
|
||||
test: {
|
||||
...sharedUiTestConfig,
|
||||
name: "browser",
|
||||
include: ["src/**/*.browser.test.ts"],
|
||||
setupFiles: ["./src/test-helpers/lit-warnings.setup.ts"],
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import { defineConfig } from "vitest/config";
|
||||
import { resolveDefaultVitestPool } from "../vitest.shared.config.ts";
|
||||
|
||||
// Node-only tests for pure logic (no Playwright/browser dependency).
|
||||
export default defineConfig({
|
||||
test: {
|
||||
isolate: false,
|
||||
pool: resolveDefaultVitestPool(),
|
||||
runner: "../test/non-isolated-runner.ts",
|
||||
testTimeout: 120_000,
|
||||
include: ["src/**/*.node.test.ts"],
|
||||
environment: "node",
|
||||
|
||||
Reference in New Issue
Block a user