mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-24 16:32:29 +00:00
test: default scoped vitest configs to no-isolate
This commit is contained in:
33
test/vitest-scoped-config.test.ts
Normal file
33
test/vitest-scoped-config.test.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import channelsConfig from "../vitest.channels.config.ts";
|
||||
import extensionsConfig from "../vitest.extensions.config.ts";
|
||||
import { createScopedVitestConfig, resolveVitestIsolation } from "../vitest.scoped-config.ts";
|
||||
|
||||
describe("resolveVitestIsolation", () => {
|
||||
it("defaults shared scoped configs to non-isolated workers", () => {
|
||||
expect(resolveVitestIsolation({})).toBe(false);
|
||||
});
|
||||
|
||||
it("restores isolate mode when explicitly requested", () => {
|
||||
expect(resolveVitestIsolation({ OPENCLAW_TEST_ISOLATE: "1" })).toBe(true);
|
||||
expect(resolveVitestIsolation({ OPENCLAW_TEST_NO_ISOLATE: "0" })).toBe(true);
|
||||
expect(resolveVitestIsolation({ OPENCLAW_TEST_NO_ISOLATE: "false" })).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("createScopedVitestConfig", () => {
|
||||
it("applies non-isolated mode by default", () => {
|
||||
const config = createScopedVitestConfig(["src/example.test.ts"]);
|
||||
expect(config.test?.isolate).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("scoped vitest configs", () => {
|
||||
it("defaults channel tests to non-isolated mode", () => {
|
||||
expect(channelsConfig.test?.isolate).toBe(false);
|
||||
});
|
||||
|
||||
it("defaults extension tests to non-isolated mode", () => {
|
||||
expect(extensionsConfig.test?.isolate).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import unitConfig from "../vitest.unit.config.ts";
|
||||
import {
|
||||
loadExtraExcludePatternsFromEnv,
|
||||
loadIncludePatternsFromEnv,
|
||||
@@ -77,3 +78,9 @@ describe("loadExtraExcludePatternsFromEnv", () => {
|
||||
).toThrow(/JSON array/u);
|
||||
});
|
||||
});
|
||||
|
||||
describe("unit vitest config", () => {
|
||||
it("defaults unit tests to non-isolated mode", () => {
|
||||
expect(unitConfig.test?.isolate).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user