mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 01:31:08 +00:00
fix(ci): restore bundled vitest lane
This commit is contained in:
@@ -109,4 +109,33 @@ describe("unit vitest config", () => {
|
||||
expect.arrayContaining(["src/commands/**", "src/config/**", "src/security/**"]),
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps bundled unit include files out of the resolved exclude list", () => {
|
||||
const unitConfig = createUnitVitestConfigWithOptions(
|
||||
{},
|
||||
{
|
||||
includePatterns: [
|
||||
"src/infra/matrix-plugin-helper.test.ts",
|
||||
"src/plugin-sdk/facade-runtime.test.ts",
|
||||
"src/plugins/loader.test.ts",
|
||||
],
|
||||
},
|
||||
);
|
||||
|
||||
expect(unitConfig.test?.include).toEqual([
|
||||
"src/infra/matrix-plugin-helper.test.ts",
|
||||
"src/plugin-sdk/facade-runtime.test.ts",
|
||||
"src/plugins/loader.test.ts",
|
||||
]);
|
||||
expect(unitConfig.test?.exclude).not.toEqual(
|
||||
expect.arrayContaining([
|
||||
"src/infra/**",
|
||||
"src/plugin-sdk/**",
|
||||
"src/plugins/**",
|
||||
"src/infra/matrix-plugin-helper.test.ts",
|
||||
"src/plugin-sdk/facade-runtime.test.ts",
|
||||
"src/plugins/loader.test.ts",
|
||||
]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import { loadPatternListFromEnv, narrowIncludePatternsForCli } from "./vitest.pa
|
||||
import { resolveVitestIsolation } from "./vitest.scoped-config.ts";
|
||||
import { sharedVitestConfig } from "./vitest.shared.config.ts";
|
||||
import {
|
||||
isBundledPluginDependentUnitTestFile,
|
||||
unitTestAdditionalExcludePatterns,
|
||||
unitTestIncludePatterns,
|
||||
} from "./vitest.unit-paths.mjs";
|
||||
@@ -34,6 +35,15 @@ export function createUnitVitestConfigWithOptions(
|
||||
const isolate = resolveVitestIsolation(env);
|
||||
const defaultIncludePatterns = options.includePatterns ?? unitTestIncludePatterns;
|
||||
const cliIncludePatterns = narrowIncludePatternsForCli(defaultIncludePatterns, options.argv);
|
||||
const protectedIncludeFiles = new Set(
|
||||
defaultIncludePatterns.filter((pattern) => isBundledPluginDependentUnitTestFile(pattern)),
|
||||
);
|
||||
const baseExcludePatterns = unitTestAdditionalExcludePatterns.filter((pattern) => {
|
||||
if (protectedIncludeFiles.size === 0) {
|
||||
return true;
|
||||
}
|
||||
return ![...protectedIncludeFiles].some((file) => pattern === file || pattern.endsWith("/**"));
|
||||
});
|
||||
return defineProject({
|
||||
...sharedVitestConfig,
|
||||
test: {
|
||||
@@ -48,7 +58,7 @@ export function createUnitVitestConfigWithOptions(
|
||||
exclude: [
|
||||
...new Set([
|
||||
...exclude,
|
||||
...unitTestAdditionalExcludePatterns,
|
||||
...baseExcludePatterns,
|
||||
...(options.extraExcludePatterns ?? []),
|
||||
...loadExtraExcludePatternsFromEnv(env),
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user