Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix(tests): resolve 10 failing tests on Windows (#2307)

Tahiti18acd078f59e0b
diff --git a/scripts/lib/resolve-formatter.js b/scripts/lib/resolve-formatter.js
index a118752f9..3fec591c9 100644
--- a/scripts/lib/resolve-formatter.js
+++ b/scripts/lib/resolve-formatter.js
@@ -9,6 +9,7 @@
'use strict';
const fs = require('fs');
+const os = require('os');
const path = require('path');
// ── Caches (per-process, cleared on next hook invocation) ───────────
@@ -58,8 +59,12 @@ const FORMATTER_PACKAGES = {
function findProjectRoot(startDir) {
if (projectRootCache.has(startDir)) return projectRootCache.get(startDir);
+ const homeDir = os.homedir();
let dir = startDir;
while (dir !== path.dirname(dir)) {
+ // Stop before checking the home directory to avoid treating global
+ // dotfiles (e.g. ~/.prettierrc) as a project root marker.
+ if (dir === homeDir) break;
for (const marker of PROJECT_ROOT_MARKERS) {
if (fs.existsSync(path.join(dir, marker))) {
projectRootCache.set(startDir, dir);
diff --git a/tests/scripts/instinct-cli-projects.test.js b/tests/scripts/instinct-cli-projects.test.js
index d2d95161f..73289f73a 100644
--- a/tests/scripts/instinct-cli-projects.test.js
+++ b/tests/scripts/instinct-cli-projects.test.js
@@ -17,6 +17,23 @@ const cliPath = path.join(
'instinct-cli.py'
);
+function detectPython3() {
+ for (const bin of ['python3', 'python']) {
+ const r = spawnSync(bin, ['--version'], { encoding: 'utf8' });
+ if (r.status === 0 && /Python 3/.test(r.stdout + r.stderr)) return bin;
+ }
+ return null;
+}
+
+const PYTHON3 = detectPython3();
+if (!PYTHON3) {
+ console.log('\n=== Testing instinct-cli.py projects maintenance ===\n');
+ console.log(' - skipped: Python 3 not found in PATH');
+ console.log('\nPassed: 0');
+ console.log('Failed: 0');
+ process.exit(0);
+}
+
function test(name, fn) {
try {
fn();
@@ -101,7 +118,7 @@ function runGit(cwd, args) {
}
function runCli(root, args, options = {}) {
- return spawnSync('python3', [cliPath, ...args], {
+ return spawnSync(PYTHON3, [cliPath, ...args], {
cwd: options.cwd || repoRoot,
encoding: 'utf8',
env: {