Skip to content

Commit 8650807

Browse files
committed
disable fail fast
1 parent 7068b4f commit 8650807

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
lines changed

.github/workflows/acceptance.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Linux Tests
1+
name: Acceptance Tests
22

33
on:
44
push:
@@ -12,6 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [linux, windows]
15+
fail-fast: false
1516

1617
steps:
1718
- uses: actions/checkout@v4

lib/vitest/hooks.mjs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import os from 'os';
2020
import path from 'path';
2121
import { vi } from 'vitest';
2222
import TestDriverSDK from '../../sdk.js';
23+
import { events } from '../../agent/events.js';
2324

2425
/**
2526
* Set up console spies using Vitest's vi.spyOn to intercept console logs
@@ -103,7 +104,7 @@ function setupConsoleSpy(client, taskId) {
103104
// Store spies on client for cleanup
104105
client._consoleSpies = { logSpy, errorSpy, warnSpy, infoSpy };
105106

106-
console.log(`[testdriver] Console spy set up for task: ${taskId}`);
107+
client.emitter.emit(events.log.debug, `Console spy set up for task: ${taskId}`);
107108
}
108109

109110
/**
@@ -166,9 +167,7 @@ export function TestDriver(context, options = {}) {
166167
// Priority: test options > plugin options > environment variable > default (linux)
167168
if (!mergedOptions.os && process.env.TD_OS) {
168169
mergedOptions.os = process.env.TD_OS;
169-
console.log(`[testdriver] Set mergedOptions.os = ${mergedOptions.os} from TD_OS environment variable`);
170170
}
171-
console.log(`[testdriver] Final mergedOptions.os = ${mergedOptions.os}`);
172171

173172
// Extract TestDriver-specific options
174173
const apiKey = mergedOptions.apiKey || process.env.TD_API_KEY;
@@ -186,21 +185,27 @@ export function TestDriver(context, options = {}) {
186185
testdriver.__vitestContext = context.task;
187186
testDriverInstances.set(context.task, testdriver);
188187

188+
// Log OS detection after testdriver is created
189+
if (process.env.TD_OS) {
190+
testdriver.emitter.emit(events.log.debug, `Set mergedOptions.os = ${mergedOptions.os} from TD_OS environment variable`);
191+
}
192+
testdriver.emitter.emit(events.log.debug, `Final mergedOptions.os = ${mergedOptions.os}`);
193+
189194
// Auto-connect if enabled (default: true)
190195
const autoConnect = config.autoConnect !== undefined ? config.autoConnect : true;
191196
const debugConsoleSpy = process.env.TD_DEBUG_CONSOLE_SPY === 'true';
192197

193198
if (autoConnect) {
194199
testdriver.__connectionPromise = (async () => {
195-
console.log('[testdriver] Connecting to sandbox...');
200+
testdriver.emitter.emit(events.log.debug, 'Connecting to sandbox...');
196201
if (debugConsoleSpy) {
197202
console.log('[DEBUG] Before auth - sandbox.instanceSocketConnected:', testdriver.sandbox?.instanceSocketConnected);
198203
}
199204

200205
await testdriver.auth();
201206
await testdriver.connect();
202207

203-
console.log('[testdriver] ✅ Connected to sandbox');
208+
testdriver.emitter.emit(events.log.debug, '✅ Connected to sandbox');
204209

205210
if (debugConsoleSpy) {
206211
console.log('[DEBUG] After connect - sandbox.instanceSocketConnected:', testdriver.sandbox?.instanceSocketConnected);
@@ -221,8 +226,8 @@ export function TestDriver(context, options = {}) {
221226
: `touch ${logPath}`;
222227

223228
await testdriver.exec(shell, createLogCmd, 10000, true);
224-
console.log('[testdriver] ✅ Created log file:', logPath);
225-
229+
testdriver.emitter.emit(events.log.debug, `✅ Created log file: ${logPath}`);
230+
226231
// Add automatic log tracking when dashcam starts
227232
// Store original start method
228233

@@ -234,20 +239,20 @@ export function TestDriver(context, options = {}) {
234239
// Register cleanup handler with dashcam.stop()
235240
if (!lifecycleHandlers.has(context.task)) {
236241
const cleanup = async () => {
237-
console.log('[testdriver] Cleaning up TestDriver client...');
242+
testdriver.emitter.emit(events.log.debug, 'Cleaning up TestDriver client...');
238243
try {
239244
// Stop dashcam if it was started - with timeout to prevent hanging
240245
if (testdriver._dashcam && testdriver._dashcam.recording) {
241246
try {
242247
const dashcamUrl = await testdriver.dashcam.stop();
243-
console.log('🎥 Dashcam URL:', dashcamUrl);
248+
testdriver.emitter.emit(events.log.debug, `🎥 Dashcam URL: ${dashcamUrl}`);
244249

245250
// Write test result to file for the reporter (cross-process communication)
246251
// This should happen regardless of whether dashcam succeeded, to ensure platform info is available
247252
const testId = context.task.id;
248-
console.log(`[testdriver] testdriver.os value: ${testdriver.os}`);
253+
testdriver.emitter.emit(events.log.debug, `testdriver.os value: ${testdriver.os}`);
249254
const platform = testdriver.os || 'linux';
250-
console.log(`[testdriver] Using platform: ${platform}`);
255+
testdriver.emitter.emit(events.log.debug, `Using platform: ${platform}`);
251256
const absolutePath = context.task.file?.filepath || context.task.file?.name || 'unknown';
252257
const projectRoot = process.cwd();
253258
const testFile = absolutePath !== 'unknown'
@@ -271,12 +276,12 @@ export function TestDriver(context, options = {}) {
271276
};
272277

273278
fs.writeFileSync(testResultFile, JSON.stringify(testResult, null, 2));
274-
console.log(`[testdriver] ✅ Wrote test result to ${testResultFile}`);
279+
testdriver.emitter.emit(events.log.debug, `✅ Wrote test result to ${testResultFile}`);
275280

276281
// Also register in memory if plugin is available
277282
if (globalThis.__testdriverPlugin?.registerDashcamUrl) {
278283
globalThis.__testdriverPlugin.registerDashcamUrl(testId, dashcamUrl, platform);
279-
console.log(`[testdriver] ✅ Registered test result in memory for test ${testId}`);
284+
testdriver.emitter.emit(events.log.debug, `✅ Registered test result in memory for test ${testId}`);
280285
}
281286
} catch (error) {
282287
// Log more detailed error information for debugging
@@ -306,7 +311,7 @@ export function TestDriver(context, options = {}) {
306311
testdriver.disconnect(),
307312
new Promise((resolve) => setTimeout(resolve, 5000)) // 5s timeout for disconnect
308313
]);
309-
console.log('✅ Client disconnected');
314+
testdriver.emitter.emit(events.log.debug, '✅ Client disconnected');
310315
} catch (error) {
311316
console.error('Error disconnecting client:', error);
312317
}

sdk.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ class TestDriverSDK {
11021102

11031103
// Store os and resolution for API requests
11041104
this.os = options.os || "linux";
1105-
console.log(`[SDK Constructor] Setting this.os = ${this.os} (from options.os = ${options.os})`);
1105+
this.emitter.emit(events.log.debug, `Setting this.os = ${this.os} (from options.os = ${options.os})`);
11061106
this.resolution = options.resolution || "1366x768";
11071107

11081108
// Store newSandbox preference from options
@@ -1270,26 +1270,26 @@ class TestDriverSDK {
12701270

12711271
await this.exec(shell, createLogCmd, 10000, true);
12721272

1273-
console.log('[provision.chrome] Adding web logs to dashcam...');
1273+
this.emitter.emit(events.log.debug, 'Adding web logs to dashcam...');
12741274
try {
12751275
const urlObj = new URL(url);
12761276
const domain = urlObj.hostname;
12771277
const pattern = `*${domain}*`;
12781278
await this._dashcam.addWebLog(pattern, 'Web Logs');
1279-
console.log(`[provision.chrome] ✅ Web logs added to dashcam (pattern: ${pattern})`);
1279+
this.emitter.emit(events.log.debug, `✅ Web logs added to dashcam (pattern: ${pattern})`);
12801280

12811281
await this._dashcam.addFileLog(logPath, "TestDriver Log");
12821282

12831283
} catch (error) {
1284-
console.warn('[provision.chrome] ⚠️ Failed to add web logs:', error.message);
1284+
this.emitter.emit(events.log.warn, `⚠️ Failed to add web logs: ${error.message}`);
12851285
}
12861286
}
12871287

12881288
// Automatically start dashcam if not already recording
12891289
if (!this._dashcam || !this._dashcam.recording) {
1290-
console.log('[provision.chrome] Starting dashcam...');
1290+
this.emitter.emit(events.log.debug, 'Starting dashcam...');
12911291
await this.dashcam.start();
1292-
console.log('[provision.chrome] ✅ Dashcam started');
1292+
this.emitter.emit(events.log.debug, '✅ Dashcam started');
12931293
}
12941294

12951295
// Set up Chrome profile with preferences
@@ -1345,7 +1345,7 @@ class TestDriverSDK {
13451345
: `cat > "${prefsPath}" << 'EOF'\n${prefsJson}\nEOF`;
13461346

13471347
await this.exec(shell, writePrefCmd, 10000, true);
1348-
console.log('[provision.chrome] ✅ Chrome preferences configured');
1348+
this.emitter.emit(events.log.debug, '✅ Chrome preferences configured');
13491349

13501350
// Build Chrome launch command
13511351
const chromeArgs = [];
@@ -1384,15 +1384,15 @@ class TestDriverSDK {
13841384
const urlObj = new URL(url);
13851385
const domain = urlObj.hostname;
13861386

1387-
console.log(`[provision.chrome] Waiting for domain "${domain}" to appear in URL bar...`);
1387+
this.emitter.emit(events.log.debug, `Waiting for domain "${domain}" to appear in URL bar...`);
13881388

13891389
for (let attempt = 0; attempt < 30; attempt++) {
13901390
const result = await this.find(`${domain}`);
13911391

1392-
console.log(`[provision.chrome] Checking for domain in URL bar (attempt ${attempt + 1}/30)...`);
1392+
this.emitter.emit(events.log.debug, `Checking for domain in URL bar (attempt ${attempt + 1}/30)...`);
13931393

13941394
if (result.found()) {
1395-
console.log(`[provision.chrome] ✅ Chrome ready at ${url}`);
1395+
this.emitter.emit(events.log.debug, `✅ Chrome ready at ${url}`);
13961396
break;
13971397
} else {
13981398
await new Promise(resolve => setTimeout(resolve, 1000));
@@ -1451,7 +1451,7 @@ class TestDriverSDK {
14511451

14521452
// Wait for VS Code to be ready
14531453
await this.focusApplication('Visual Studio Code');
1454-
console.log('[provision.vscode] ✅ VS Code ready');
1454+
this.emitter.emit(events.log.debug, '✅ VS Code ready');
14551455
},
14561456

14571457
/**
@@ -1488,7 +1488,7 @@ class TestDriverSDK {
14881488
}
14891489

14901490
await this.focusApplication('Electron');
1491-
console.log('[provision.electron] ✅ Electron app ready');
1491+
this.emitter.emit(events.log.debug, '✅ Electron app ready');
14921492
},
14931493
};
14941494
}
@@ -1590,11 +1590,11 @@ class TestDriverSDK {
15901590

15911591
// Ensure this.os reflects the actual sandbox OS (important for vitest reporter)
15921592
// After buildEnv, agent.sandboxOs should contain the correct OS value
1593-
console.log(`[SDK] After buildEnv: this.agent.sandboxOs = ${this.agent.sandboxOs}, this.os (before) = ${this.os}`);
1593+
this.emitter.emit(events.log.debug, `After buildEnv: this.agent.sandboxOs = ${this.agent.sandboxOs}, this.os (before) = ${this.os}`);
15941594
if (this.agent.sandboxOs) {
15951595
this.os = this.agent.sandboxOs;
15961596
}
1597-
console.log(`[SDK] After buildEnv: this.os (after) = ${this.os}`);
1597+
this.emitter.emit(events.log.debug, `After buildEnv: this.os (after) = ${this.os}`);
15981598

15991599
// Also ensure sandbox.os is set for consistency
16001600
if (this.agent.sandbox && this.os) {

0 commit comments

Comments
 (0)