mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 02:57:36 +00:00
- test:changed exits before starting Vitest when Git reports no changed files. - Unrecorded tests beyond 100 in scope use Vitest's static import graph instead of all running, so a fresh worktree's first changed run no longer runs the whole suite (patched RecordedModulesResolver; CI does not record, unchanged). - Bun's slow config load was the SQLite import scan statting every unit test; filtered runs now classify only the tests their filters can select, and the scan walks directories instead of fs.globSync. - Silence the native config loader notice on every run. - Zod's test bundle is content-addressed and reused, so a killed run leaks nothing; leaked per-run directories older than 6h are swept. - build:packages skips compiling when package inputs, compiler, and dist are unchanged; test scripts no longer nest pnpm invocations.
75 lines
3.2 KiB
Diff
75 lines
3.2 KiB
Diff
diff --git a/dist/chunks/cli-api.De07GUeT.js b/dist/chunks/cli-api.De07GUeT.js
|
|
index ff6e63043ff8fa0b821d4b0b382d1fd998d85dbb..a95172c2a451f615f9472a526d7ed8a670256b47 100644
|
|
--- a/dist/chunks/cli-api.De07GUeT.js
|
|
+++ b/dist/chunks/cli-api.De07GUeT.js
|
|
@@ -10250,6 +10250,7 @@ function groupFilters(filters) {
|
|
* Finds test specifications that loaded any of the changed files during their last recorded run.
|
|
* A specification without a record is always affected.
|
|
*/
|
|
+const UNRECORDED_RUN_LIMIT = 100;
|
|
class RecordedModulesResolver {
|
|
vitest;
|
|
related;
|
|
@@ -10267,13 +10268,30 @@ class RecordedModulesResolver {
|
|
projectSpecs.push(spec);
|
|
}
|
|
const affected = /* @__PURE__ */ new Set();
|
|
- for (const [project, projectSpecs] of specsByProject) this.findAffectedInProject(project, projectSpecs).forEach((spec) => affected.add(spec));
|
|
+ const unrecorded = [];
|
|
+ for (const [project, projectSpecs] of specsByProject) {
|
|
+ const result = this.findAffectedInProject(project, projectSpecs);
|
|
+ result.affected.forEach((spec) => affected.add(spec));
|
|
+ unrecorded.push(...result.unrecorded);
|
|
+ }
|
|
+ // Orca: running a few unrecorded files records them; many (a fresh checkout) use the static graph instead of running everything.
|
|
+ const unrecordedAffected = unrecorded.length > UNRECORDED_RUN_LIMIT ? await new AffectedModulesResolver(this.vitest, this.related).resolve(unrecorded) : unrecorded;
|
|
+ unrecordedAffected.forEach((spec) => affected.add(spec));
|
|
return specs.filter((spec) => affected.has(spec));
|
|
}
|
|
findAffectedInProject(project, specs) {
|
|
- if (this.dependsOnConfig(project.vite.config.configFileDependencies) || this.dependsOnConfig(getEnvFiles(project))) return specs;
|
|
+ if (this.dependsOnConfig(project.vite.config.configFileDependencies) || this.dependsOnConfig(getEnvFiles(project))) return {
|
|
+ affected: specs,
|
|
+ unrecorded: []
|
|
+ };
|
|
const dependencies = this.vitest.cache._dependencies.get(project);
|
|
- if (!dependencies) return specs;
|
|
+ if (!dependencies) return project.config.globalSetup.length ? {
|
|
+ affected: specs,
|
|
+ unrecorded: []
|
|
+ } : {
|
|
+ affected: [],
|
|
+ unrecorded: specs
|
|
+ };
|
|
const changed = /* @__PURE__ */ new Set();
|
|
for (const file of this.related) {
|
|
const index = dependencies.moduleIndex.get(file);
|
|
@@ -10281,13 +10299,23 @@ class RecordedModulesResolver {
|
|
}
|
|
if (project.config.globalSetup.length) {
|
|
const globalSetup = dependencies.globalSetup;
|
|
- if (!globalSetup || globalSetup.some((index) => changed.has(index))) return specs;
|
|
+ if (!globalSetup || globalSetup.some((index) => changed.has(index))) return {
|
|
+ affected: specs,
|
|
+ unrecorded: []
|
|
+ };
|
|
}
|
|
const root = this.vitest.config.root;
|
|
- return specs.filter((spec) => {
|
|
+ const affected = [];
|
|
+ const unrecorded = [];
|
|
+ for (const spec of specs) {
|
|
const loaded = dependencies.files.get(getRootRelativePath(root, spec.moduleId));
|
|
- return !loaded || loaded.some((index) => changed.has(index));
|
|
- });
|
|
+ if (!loaded) unrecorded.push(spec);
|
|
+ else if (loaded.some((index) => changed.has(index))) affected.push(spec);
|
|
+ }
|
|
+ return {
|
|
+ affected,
|
|
+ unrecorded
|
|
+ };
|
|
}
|
|
dependsOnConfig(configDependencies) {
|
|
return !!configDependencies?.some((file) => this.related.includes(file));
|