fix(ci): isolate discord reply listener test
This commit is contained in:
@@ -8,6 +8,7 @@ type CiTestPlan = {
|
||||
|
||||
const TEST_ROOTS = ["bin", "script", "src"] as const
|
||||
const MODULE_MOCK_PATTERN = "mock.module("
|
||||
const ALWAYS_ISOLATED_TEST_FILES = ["src/openclaw/__tests__/reply-listener-discord.test.ts"] as const
|
||||
|
||||
async function collectTestFiles(rootDirectory: string): Promise<string[]> {
|
||||
const testFiles: string[] = []
|
||||
@@ -29,13 +30,7 @@ async function usesModuleMock(rootDirectory: string, testFile: string): Promise<
|
||||
}
|
||||
|
||||
function toIsolatedTarget(testFile: string): string {
|
||||
const pathSegments = testFile.split("/")
|
||||
|
||||
if (pathSegments.length <= 3) {
|
||||
return testFile
|
||||
}
|
||||
|
||||
return pathSegments.slice(0, -1).join("/")
|
||||
return testFile
|
||||
}
|
||||
|
||||
function isCoveredByTarget(testFile: string, isolatedTarget: string): boolean {
|
||||
@@ -60,8 +55,11 @@ export async function createCiTestPlan(rootDirectory: string = process.cwd()): P
|
||||
}
|
||||
}
|
||||
|
||||
const isolatedTestFiles = Array.from(
|
||||
new Set([...isolatedModuleMockFiles, ...ALWAYS_ISOLATED_TEST_FILES.filter((testFile) => allTestFiles.includes(testFile))]),
|
||||
)
|
||||
const isolatedTestTargets = collapseNestedTargets(
|
||||
Array.from(new Set(isolatedModuleMockFiles.map((testFile) => toIsolatedTarget(testFile)))).sort((left, right) =>
|
||||
isolatedTestFiles.map((testFile) => toIsolatedTarget(testFile)).sort((left, right) =>
|
||||
left.localeCompare(right),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user