Skip to content

Commit f5188d7

Browse files
committed
major cleanup
1 parent ed2d1d9 commit f5188d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+115
-759
lines changed

.github/workflows/linux-tests.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Linux Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run Linux tests
26+
run: npx vitest run test/testdriver/*.test.mjs
27+
env:
28+
TD_API_KEY: ${{ secrets.TD_API_KEY }}

agent/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,12 @@ class TestDriverAgent extends EventEmitter2 {
224224
this.emitter.emit(events.error.fatal, errorContext);
225225
} else {
226226
this.emitter.emit(
227-
events.error.fatal,
228-
theme.red("Fatal Error") + `\n${error}`,
227+
events.error.fatal,error,
229228
);
230229
}
231230

232231
if (skipPostrun) {
233-
this.exit(true);
232+
return await this.exit(true);
234233
} else {
235234
try {
236235
await this.summarize(error.message);
@@ -2160,7 +2159,7 @@ Please check your network connection, TD_API_KEY, or the service status.`,
21602159
type: "create",
21612160
resolution: this.config.TD_RESOLUTION,
21622161
ci: this.config.CI,
2163-
os: this.sandboxOs || "windows",
2162+
os: this.sandboxOs || "linux",
21642163
};
21652164

21662165
// Add AMI and instance type if specified

agent/interface.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function createCommandDefinitions(agent) {
6969
os: Flags.string({
7070
description: "Operating system for the sandbox (windows or linux)",
7171
options: ["windows", "linux"],
72-
default: "windows",
72+
default: "linux",
7373
}),
7474
},
7575
handler: async (args, flags) => {
@@ -246,7 +246,7 @@ function createCommandDefinitions(agent) {
246246
os: Flags.string({
247247
description: "Operating system for the sandbox (windows or linux)",
248248
options: ["windows", "linux"],
249-
default: "windows",
249+
default: "linux",
250250
}),
251251
},
252252
handler: async (args, flags) => {

docs/v7/api/dashcam.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ For more control, create a Dashcam instance directly:
3838

3939
```javascript
4040
import TestDriver from 'testdriverai';
41-
import Dashcam from 'testdriverai/src/core/Dashcam.js';
41+
import Dashcam from 'testdriverai/lib/core/Dashcam.js';
4242

4343
const client = await TestDriver.create({ os: 'linux' });
4444
const dashcam = new Dashcam(client, {
@@ -290,7 +290,7 @@ dashcam.client // TestDriver instance
290290
```javascript
291291
import { test } from 'vitest';
292292
import TestDriver from 'testdriverai';
293-
import Dashcam from 'testdriverai/src/core/Dashcam.js';
293+
import Dashcam from 'testdriverai/lib/core/Dashcam.js';
294294

295295
test('record test execution', async () => {
296296
const client = await TestDriver.create({ os: 'linux' });

docs/v7/getting-started/configuration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ await testdriver.find('button', { threshold: -1 }); // disable cache
236236
## Dashcam Configuration
237237

238238
```javascript
239-
import Dashcam from 'testdriverai/src/core/Dashcam.js';
239+
import Dashcam from 'testdriverai/lib/core/Dashcam.js';
240240

241241
const dashcam = new Dashcam(client, {
242242
apiKey: process.env.TD_API_KEY,

docs/v7/guides/implementation-plan.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Extract core components into clean, composable modules without breaking existing
1414
### Tasks
1515

1616
#### 1.1 Create Dashcam Class (Priority: HIGH)
17-
**File**: `src/core/Dashcam.js` (new)
17+
**File**: `lib/core/Dashcam.js` (new)
1818

1919
**What to build:**
2020
```javascript
@@ -123,14 +123,14 @@ export async function fillForm(client, formData) {
123123
{
124124
"exports": {
125125
".": "./sdk.js",
126-
"./core": "./src/core/index.js",
126+
"./core": "./lib/core/index.js",
127127
"./helpers": "./src/helpers/index.js",
128128
"./vitest": "./interfaces/vitest-plugin.mjs"
129129
}
130130
}
131131
```
132132
133-
**Create**: `src/core/index.js`
133+
**Create**: `lib/core/index.js`
134134
```javascript
135135
export { default as TestDriver } from '../../sdk.js';
136136
export { Dashcam } from './Dashcam.js';
@@ -223,7 +223,7 @@ export function useTestDriver(options = {}) {
223223
**What to build:**
224224
```javascript
225225
import { beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
226-
import { Dashcam } from '../../src/core/Dashcam.js';
226+
import { Dashcam } from '../../lib/core/Dashcam.js';
227227

228228
let dashcamInstance = null;
229229

@@ -370,7 +370,7 @@ Build preset system with at least 2 working presets (Chrome, VSCode).
370370
### Tasks
371371

372372
#### 3.1 Define Preset Interface (Priority: HIGH)
373-
**File**: `src/presets/types.js` (new)
373+
**File**: `lib/presets/types.js` (new)
374374

375375
**What to build:**
376376
```javascript
@@ -423,7 +423,7 @@ export function definePreset(config) {
423423
---
424424

425425
#### 3.2 Build Chrome Preset (Priority: HIGH)
426-
**File**: `src/presets/chrome.js` (new)
426+
**File**: `lib/presets/chrome.js` (new)
427427

428428
**What to build:**
429429
```javascript
@@ -484,7 +484,7 @@ export function chromePreset(options = {}) {
484484
---
485485

486486
#### 3.3 Build VSCode Preset (Priority: MEDIUM)
487-
**File**: `src/presets/vscode.js` (new)
487+
**File**: `lib/presets/vscode.js` (new)
488488

489489
**What to build:**
490490
```javascript
@@ -549,7 +549,7 @@ export function vscodePreset(options = {}) {
549549
---
550550

551551
#### 3.4 Create Preset Registry (Priority: LOW)
552-
**File**: `src/presets/index.js` (new)
552+
**File**: `lib/presets/index.js` (new)
553553

554554
**What to build:**
555555
```javascript

docs/v7/guides/sdk-v7-complete.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Implementation of the TestDriver SDK v7 redesign following progressive disclosur
99
## Phase 1: Core Foundation ✅ (Week 1-2)
1010

1111
### Task 1.1: Dashcam Class Extraction ✅
12-
- **Created:** `src/core/Dashcam.js` (422 lines)
12+
- **Created:** `lib/core/Dashcam.js` (422 lines)
1313
- **Features:**
1414
- Composable Dashcam class independent of lifecycle helpers
1515
- Methods: `auth()`, `addLog()`, `start()`, `stop()`, `isRecording()`
@@ -25,10 +25,10 @@ Implementation of the TestDriver SDK v7 redesign following progressive disclosur
2525
- **Modified:** `package.json`
2626
- **Added exports:**
2727
- `"."``./sdk.js` (main SDK)
28-
- `"./core"``./src/core/index.js` (TestDriver + Dashcam)
28+
- `"./core"``./lib/core/index.js` (TestDriver + Dashcam)
2929
- `"./vitest"``./interfaces/vitest-plugin.mjs` (plugin)
30-
- `"./vitest/hooks"``./src/vitest/hooks.mjs` (hooks)
31-
- `"./presets"``./src/presets/index.mjs` (presets)
30+
- `"./vitest/hooks"``./lib/vitest/hooks.mjs` (hooks)
31+
- `"./presets"``./lib/presets/index.mjs` (presets)
3232

3333
### Key Achievements:
3434
- ✅ Backward compatibility maintained via thin wrappers
@@ -43,7 +43,7 @@ Implementation of the TestDriver SDK v7 redesign following progressive disclosur
4343
## Phase 2: Vitest Plugin Enhancement ✅ (Week 3-4)
4444

4545
### Task 2.1: Vitest Hooks API ✅
46-
- **Created:** `src/vitest/hooks.mjs` (221 lines)
46+
- **Created:** `lib/vitest/hooks.mjs` (221 lines)
4747
- **Three hooks implemented:**
4848
1. `useTestDriver(context, options)` - Managed TestDriver instance
4949
- Auto-connect to sandbox (default: true)
@@ -78,7 +78,7 @@ Implementation of the TestDriver SDK v7 redesign following progressive disclosur
7878
## Phase 3: Presets System ✅ (Week 5-6)
7979

8080
### Task 3.1: Built-in Presets ✅
81-
- **Created:** `src/presets/index.mjs` (400+ lines)
81+
- **Created:** `lib/presets/index.mjs` (400+ lines)
8282

8383
**chromePreset:**
8484
- Auto-launches Chrome with configurable URL
@@ -135,17 +135,17 @@ Implementation of the TestDriver SDK v7 redesign following progressive disclosur
135135

136136
### Task 4.1: TypeScript Definitions ✅
137137

138-
**Created: `src/core/index.d.ts`**
138+
**Created: `lib/core/index.d.ts`**
139139
- Full types for `TestDriver` and `Dashcam` classes
140140
- Interfaces: `DashcamOptions`, `LogConfig`, `TestDriverOptions`, `ConnectOptions`
141141
- Comprehensive JSDoc comments
142142

143-
**Created: `src/vitest/hooks.d.ts`**
143+
**Created: `lib/vitest/hooks.d.ts`**
144144
- Types for all three hooks
145145
- Interfaces: `VitestContext`, `UseTestDriverOptions`, `UseDashcamOptions`
146146
- Full autocomplete support
147147

148-
**Created: `src/presets/index.d.ts`**
148+
**Created: `lib/presets/index.d.ts`**
149149
- Types for all presets
150150
- Interfaces: `ChromePresetOptions`, `VSCodePresetOptions`, `ElectronPresetOptions`
151151
- `PresetSetupFunction` and `PresetConfig` types
@@ -248,9 +248,9 @@ import { authDashcam, startDashcam, stopDashcam } from 'testdriverai';
248248
## Key Metrics
249249

250250
### Lines of Code (New)
251-
- `src/core/Dashcam.js`: 422 lines
252-
- `src/vitest/hooks.mjs`: 221 lines
253-
- `src/presets/index.mjs`: 400+ lines
251+
- `lib/core/Dashcam.js`: 422 lines
252+
- `lib/vitest/hooks.mjs`: 221 lines
253+
- `lib/presets/index.mjs`: 400+ lines
254254
- TypeScript definitions: 500+ lines
255255
- Documentation: 1000+ lines
256256
- **Total new code:** ~2500+ lines
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)