mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-02 15:17:15 +00:00
test: narrow weak-random rg scan globs
This commit is contained in:
@@ -5,6 +5,18 @@ import { describe, expect, it } from "vitest";
|
|||||||
import { listRuntimeSourceFiles, shouldSkipRuntimeSourcePath } from "../test-utils/repo-scan.js";
|
import { listRuntimeSourceFiles, shouldSkipRuntimeSourcePath } from "../test-utils/repo-scan.js";
|
||||||
|
|
||||||
const SCAN_ROOTS = ["src", "extensions"] as const;
|
const SCAN_ROOTS = ["src", "extensions"] as const;
|
||||||
|
const RUNTIME_TS_GLOBS = [
|
||||||
|
"*.ts",
|
||||||
|
"!*.test.ts",
|
||||||
|
"!*.test-helpers.ts",
|
||||||
|
"!*.test-utils.ts",
|
||||||
|
"!*.e2e.ts",
|
||||||
|
"!*.d.ts",
|
||||||
|
"!**/__tests__/**",
|
||||||
|
"!**/tests/**",
|
||||||
|
"!**/*test-helpers*.ts",
|
||||||
|
"!**/*test-utils*.ts",
|
||||||
|
] as const;
|
||||||
|
|
||||||
async function findWeakRandomPatternMatches(repoRoot: string): Promise<string[]> {
|
async function findWeakRandomPatternMatches(repoRoot: string): Promise<string[]> {
|
||||||
const rgResult = spawnSync(
|
const rgResult = spawnSync(
|
||||||
@@ -13,8 +25,7 @@ async function findWeakRandomPatternMatches(repoRoot: string): Promise<string[]>
|
|||||||
"--line-number",
|
"--line-number",
|
||||||
"--no-heading",
|
"--no-heading",
|
||||||
"--color=never",
|
"--color=never",
|
||||||
"--glob",
|
...RUNTIME_TS_GLOBS.flatMap((glob) => ["--glob", glob]),
|
||||||
"*.ts",
|
|
||||||
"Date\\.now.*Math\\.random|Math\\.random.*Date\\.now",
|
"Date\\.now.*Math\\.random|Math\\.random.*Date\\.now",
|
||||||
...SCAN_ROOTS,
|
...SCAN_ROOTS,
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user