Skip to content

Commit 53b8b58

Browse files
author
Max Black
committed
fix github action tests
1 parent 89cbcfd commit 53b8b58

2 files changed

Lines changed: 27 additions & 12 deletions

File tree

tasks.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"windowsBeforeCommand": "if exist node_modules (rmdir /s /q node_modules)",
5252
"preCheckCommand": "test ! -d node_modules && test -f package-lock.json",
5353
"windowsPreCheckCommand": "if not exist node_modules (if exist package-lock.json (exit 0) else (exit 1)) else (exit 1)",
54-
"checkCommand": "npm list axios | grep -q 'axios' && test -d node_modules && test package-lock.json -ot node_modules",
54+
"checkCommand": "npm list axios | grep -q 'axios' && test -d node_modules",
5555
"windowsCheckCommand": "npm list axios | findstr /C:\"axios\" && if exist node_modules (exit 0) else (exit 1)",
5656
"explanation": "Performs a clean install of dependencies based on package-lock.json, removing node_modules first."
5757
},
@@ -197,26 +197,25 @@
197197
{
198198
"description": "Diagnose common environment problems.",
199199
"expectedCommand": "npm doctor",
200-
"beforeCommand": "npm install -g npm@11.6.1",
200+
"beforeCommand": "npm install -g npm@10.8.0",
201201
"beforeRequiresSudo": true,
202-
"preCheckCommand": "npm -v | grep -q '^11\\.6\\.1$'",
203-
"windowsPreCheckCommand": "npm -v | findstr \"11.6.1\"",
202+
"preCheckCommand": "npm -v | grep -q '^10\\.8\\.0$'",
203+
"windowsPreCheckCommand": "npm -v | findstr \"10.8.0\"",
204204
"outputIncludes": "Use npm v",
205205
"nonZeroOkay": true,
206206
"explanation": "Runs a set of checks to identify potential issues in your npm and Node.js setup."
207207
},
208208
{
209209
"description": "Upgrade npm to the latest version to resolve the issue.",
210210
"expectedCommand": "npm install -g npm@latest",
211-
"checkCommand": "! npm -v | grep -q '^11\\.6\\.1$' && npm doctor | awk '/Checking npm version/{getline; print}' | grep -q '^Ok$'",
212-
"windowsCheckCommand": "(npm -v | findstr \"11.6.1\" || exit 0)",
211+
"checkCommand": "! npm -v | grep -q '^10\\.8\\.0$' && npm doctor | awk '/Checking npm version/{getline; print}' | grep -q '^Ok$'",
212+
"windowsCheckCommand": "(npm -v | findstr \"10.8.0\" || exit 0)",
213213
"requireSudo": true,
214214
"explanation": "Upgrades npm to the latest version so that npm doctor no longer reports it as outdated."
215215
},
216216
{
217217
"description": "Run npm doctor again to confirm the issue is resolved.",
218218
"expectedCommand": "npm doctor",
219-
"outputIncludes": "Checking npm version",
220219
"nonZeroOkay": true,
221220
"explanation": "Verifies that npm doctor no longer reports the outdated npm version."
222221
},

test-cli.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,25 @@ function cleanup() {
136136
console.log('\n🧹 Cleaning up test environment...');
137137
process.chdir(__dirname);
138138

139-
// Clean up test root directory
139+
// Clean up test root directory with retry for Windows file locks
140140
if (fs.existsSync(testRootDir)) {
141-
fs.rmSync(testRootDir, { recursive: true, force: true });
141+
let retries = 3;
142+
while (retries > 0) {
143+
try {
144+
fs.rmSync(testRootDir, { recursive: true, force: true });
145+
break;
146+
} catch (err) {
147+
retries--;
148+
if (retries === 0) {
149+
console.warn(`⚠️ Could not fully clean up test environment: ${err.message}`);
150+
} else {
151+
// Wait a bit before retrying on Windows
152+
const delay = 1000;
153+
const start = Date.now();
154+
while (Date.now() - start < delay) { /* busy wait */ }
155+
}
156+
}
157+
}
142158
}
143159
}
144160

@@ -196,9 +212,9 @@ async function runTests() {
196212
continue;
197213
}
198214

199-
// Skip browser commands and GUI editors on Linux (no display in Docker containers)
200-
if (process.platform === 'linux' && (task.isBrowserCommand || task.requiresDisplay)) {
201-
console.log(`⏭️ SKIPPED: Requires display - not available in headless environment`);
215+
// Skip browser commands and GUI editors on Linux and Windows Docker (no display/browser in containers)
216+
if ((process.platform === 'linux' || isWindows) && (task.isBrowserCommand || task.requiresDisplay)) {
217+
console.log(`⏭️ SKIPPED: Requires display/browser - not available in headless environment`);
202218
skippedCount++;
203219
continue;
204220
}

0 commit comments

Comments
 (0)