|
1 | 1 | import { Command } from "commander"; |
2 | | -import { dirSync } from "tmp"; |
3 | | -import { writeFileSync } from "fs"; |
| 2 | +import { writeFileSync, mkdirSync, existsSync } from "fs"; |
4 | 3 | import { promisify } from "util"; |
5 | 4 | import { exec } from "child_process"; |
6 | 5 | import { randomUUID } from "crypto"; |
@@ -43,15 +42,19 @@ export const prepareTestRun = async ({ |
43 | 42 | }> => { |
44 | 43 | const code = await getPlaywrightCode(testId, token, url, octomindUrl); |
45 | 44 |
|
46 | | - const tempDir = dirSync(); |
47 | | - const testFilePath = path.join(tempDir.name, `${randomUUID()}.spec.ts`); |
| 45 | + const dirname = __dirname; |
| 46 | + const tempDir = path.join(dirname, "..", "temp"); |
| 47 | + const outputDir = "output"; |
| 48 | + if (!existsSync(tempDir)) { |
| 49 | + mkdirSync(tempDir); |
| 50 | + } |
| 51 | + const testFilePath = path.join(tempDir, `${randomUUID()}.spec.ts`); |
48 | 52 | writeFileSync(testFilePath, code); |
49 | 53 |
|
50 | | - const configFilePath = path.join(tempDir.name, `${randomUUID()}.config.ts`); |
51 | | - const outputDir = dirSync(); |
52 | | - writeFileSync(configFilePath, getConfig(url, outputDir.name)); |
| 54 | + const configFilePath = path.join(tempDir, `${randomUUID()}.config.ts`); |
| 55 | + writeFileSync(configFilePath, getConfig(url, outputDir)); |
53 | 56 |
|
54 | | - return { testFilePath, configFilePath, outputDir: outputDir.name }; |
| 57 | + return { testFilePath, configFilePath, outputDir }; |
55 | 58 | }; |
56 | 59 |
|
57 | 60 | export const debugtopus = async (): Promise<void> => { |
|
0 commit comments