Skip to content

Commit 469d5b6

Browse files
Fix test-workspace path resolution in test.js for CI environment
1 parent c662e4f commit 469d5b6

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

cloudsync-cli/test.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@
55
*/
66

77
import { execSync } from 'child_process';
8-
import { existsSync, readFileSync } from 'fs';
9-
import { join } from 'path';
8+
import { existsSync, readFileSync, mkdirSync } from 'fs';
9+
import { join, dirname } from 'path';
10+
import { fileURLToPath } from 'url';
1011

11-
const CLI_PATH = join(process.cwd(), 'bin', 'cloudsync.js');
12-
const TEST_DIR = join(process.cwd(), 'test-workspace');
12+
const __filename = fileURLToPath(import.meta.url);
13+
const __dirname = dirname(__filename);
14+
15+
const CLI_PATH = join(__dirname, 'bin', 'cloudsync.js');
16+
const TEST_DIR = join(__dirname, 'test-workspace');
17+
18+
// Ensure test-workspace directory exists
19+
if (!existsSync(TEST_DIR)) {
20+
mkdirSync(TEST_DIR, { recursive: true });
21+
}
1322

1423
function run(cmd, dir = process.cwd()) {
1524
try {

0 commit comments

Comments
 (0)