Skip to content

Commit a4751bf

Browse files
committed
bring back exec path
1 parent 6033b6b commit a4751bf

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

src/utils/npm.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import path from 'path';
33
import fs from 'fs';
44
import { logger } from './logger';
55

6+
function getExecutablePath(): string {
7+
try {
8+
const resolvedPath = path.join(getPackagePath(), "index.js");
9+
if (fs.existsSync(resolvedPath)) {
10+
return resolvedPath;
11+
} else {
12+
throw new Error('Binary found but does not exist on disk.');
13+
}
14+
} catch {
15+
throw new Error('testdriverai index.js not found');
16+
}
17+
}
18+
619
function getJSPath(): string {
720
const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
821
const jsPath = path.join(npmRoot, 'testdriverai', 'index.js');
@@ -120,4 +133,4 @@ function getNodePath(): string {
120133
throw new Error('Node.js executable not found');
121134
}
122135

123-
export { getPackageJsonVersion, compareVersions, getPackagePath, getJSPath, getNodePath };
136+
export { getExecutablePath, getPackageJsonVersion, compareVersions, getPackagePath, getJSPath, getNodePath };

testdriver/example.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
description: "Example test file"
2+
steps:
3+
- action: "navigate"
4+
url: "https://example.com"
5+
- action: "click"
6+
selector: "button[type='submit']"
7+
- action: "wait"
8+
timeout: 1000
9+
- action: "assert"
10+
selector: "h1"
11+
text: "Success"

0 commit comments

Comments
 (0)