testdriverai 7.2.89 ā 7.2.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/agent/index.js +35 -2
- package/ai/agents/testdriver.md +4 -4
- package/lib/init-project.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/agent/index.js
CHANGED
|
@@ -214,6 +214,9 @@ class TestDriverAgent extends EventEmitter2 {
|
|
|
214
214
|
// Ignore sandbox close errors during exit
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
+
|
|
218
|
+
// Clean up IDE session file
|
|
219
|
+
this.cleanupIdeSessionFile();
|
|
217
220
|
|
|
218
221
|
shouldRunPostrun =
|
|
219
222
|
!this.hasRunPostrun &&
|
|
@@ -2056,15 +2059,26 @@ ${regression}
|
|
|
2056
2059
|
const path = require("path");
|
|
2057
2060
|
|
|
2058
2061
|
const sessionDir = path.join(os.homedir(), ".testdriver");
|
|
2059
|
-
const
|
|
2062
|
+
const sessionsDir = path.join(sessionDir, "ide-sessions");
|
|
2063
|
+
|
|
2064
|
+
// Generate a unique session ID based on test file and timestamp
|
|
2065
|
+
const testFileName = (data.testFile || this.thisFile || "test")
|
|
2066
|
+
.split(path.sep).pop()
|
|
2067
|
+
.replace(/\.[^/.]+$/, ""); // Remove file extension
|
|
2068
|
+
const sessionId = `${testFileName}-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
|
|
2069
|
+
const sessionFile = path.join(sessionsDir, `${sessionId}.json`);
|
|
2060
2070
|
|
|
2061
2071
|
try {
|
|
2062
|
-
// Ensure
|
|
2072
|
+
// Ensure directories exist
|
|
2063
2073
|
if (!fs.existsSync(sessionDir)) {
|
|
2064
2074
|
fs.mkdirSync(sessionDir, { recursive: true });
|
|
2065
2075
|
}
|
|
2076
|
+
if (!fs.existsSync(sessionsDir)) {
|
|
2077
|
+
fs.mkdirSync(sessionsDir, { recursive: true });
|
|
2078
|
+
}
|
|
2066
2079
|
|
|
2067
2080
|
const sessionData = {
|
|
2081
|
+
sessionId: sessionId,
|
|
2068
2082
|
debuggerUrl: debuggerUrl,
|
|
2069
2083
|
resolution: data.resolution || this.config.TD_RESOLUTION,
|
|
2070
2084
|
testFile: data.testFile || this.thisFile,
|
|
@@ -2074,10 +2088,29 @@ ${regression}
|
|
|
2074
2088
|
|
|
2075
2089
|
fs.writeFileSync(sessionFile, JSON.stringify(sessionData, null, 2));
|
|
2076
2090
|
logger.log(`IDE session file written: ${sessionFile}`);
|
|
2091
|
+
|
|
2092
|
+
// Store session file path for cleanup on exit
|
|
2093
|
+
this._ideSessionFile = sessionFile;
|
|
2077
2094
|
} catch (error) {
|
|
2078
2095
|
logger.warn(`Failed to write IDE session file: ${error.message}`);
|
|
2079
2096
|
}
|
|
2080
2097
|
}
|
|
2098
|
+
|
|
2099
|
+
// Clean up IDE session file when test completes
|
|
2100
|
+
cleanupIdeSessionFile() {
|
|
2101
|
+
if (this._ideSessionFile) {
|
|
2102
|
+
const fs = require("fs");
|
|
2103
|
+
try {
|
|
2104
|
+
if (fs.existsSync(this._ideSessionFile)) {
|
|
2105
|
+
fs.unlinkSync(this._ideSessionFile);
|
|
2106
|
+
logger.log(`IDE session file cleaned up: ${this._ideSessionFile}`);
|
|
2107
|
+
}
|
|
2108
|
+
} catch (error) {
|
|
2109
|
+
// Ignore cleanup errors
|
|
2110
|
+
}
|
|
2111
|
+
this._ideSessionFile = null;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2081
2114
|
|
|
2082
2115
|
async connectToSandboxService() {
|
|
2083
2116
|
this.emitter.emit(
|
package/ai/agents/testdriver.md
CHANGED
|
@@ -7,7 +7,7 @@ mcp-servers:
|
|
|
7
7
|
command: npx
|
|
8
8
|
args:
|
|
9
9
|
- -p
|
|
10
|
-
- testdriverai
|
|
10
|
+
- testdriverai
|
|
11
11
|
- testdriverai-mcp
|
|
12
12
|
env:
|
|
13
13
|
TD_API_KEY: ${TD_API_KEY}
|
|
@@ -55,7 +55,7 @@ Use this agent when the user asks to:
|
|
|
55
55
|
|
|
56
56
|
**CLI:**
|
|
57
57
|
```bash
|
|
58
|
-
npx testdriverai
|
|
58
|
+
npx testdriverai init
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
**MCP (via this agent):**
|
|
@@ -97,10 +97,10 @@ Get your API key at: **https://console.testdriver.ai/team**
|
|
|
97
97
|
|
|
98
98
|
### Manual Installation
|
|
99
99
|
|
|
100
|
-
If not using `init`,
|
|
100
|
+
If not using `init`, install TestDriver:
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
-
npm install --save-dev testdriverai
|
|
103
|
+
npm install --save-dev testdriverai
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
### Test Runner
|
package/lib/init-project.js
CHANGED
|
@@ -267,7 +267,7 @@ jobs:
|
|
|
267
267
|
servers: {
|
|
268
268
|
testdriver: {
|
|
269
269
|
command: "npx",
|
|
270
|
-
args: ["-p", "testdriverai
|
|
270
|
+
args: ["-p", "testdriverai", "testdriverai-mcp"],
|
|
271
271
|
env: {
|
|
272
272
|
TD_API_KEY: "${input:testdriver-api-key}",
|
|
273
273
|
},
|
|
@@ -409,19 +409,19 @@ jobs:
|
|
|
409
409
|
if (!options.skipInstall) {
|
|
410
410
|
progress("\nš¦ Installing dependencies...");
|
|
411
411
|
try {
|
|
412
|
-
execSync("npm install -D vitest testdriverai
|
|
412
|
+
execSync("npm install -D vitest testdriverai && npm install dotenv", {
|
|
413
413
|
cwd: targetDir,
|
|
414
414
|
stdio: "pipe",
|
|
415
415
|
});
|
|
416
416
|
progress("ā Dependencies installed successfully");
|
|
417
417
|
} catch (error) {
|
|
418
418
|
errors.push("Failed to install dependencies. Run manually:");
|
|
419
|
-
errors.push(" npm install -D vitest testdriverai
|
|
419
|
+
errors.push(" npm install -D vitest testdriverai");
|
|
420
420
|
errors.push(" npm install dotenv");
|
|
421
421
|
}
|
|
422
422
|
} else {
|
|
423
423
|
progress("\nā¹ Skipped dependency installation. Run manually:");
|
|
424
|
-
progress(" npm install -D vitest testdriverai
|
|
424
|
+
progress(" npm install -D vitest testdriverai");
|
|
425
425
|
progress(" npm install dotenv");
|
|
426
426
|
}
|
|
427
427
|
|