bun-ui-tests 1.0.1 → 1.0.3
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/cli.ts +3 -3
- package/package.json +1 -1
- package/ui-runner.ts +3 -7
package/cli.ts
CHANGED
|
@@ -5,8 +5,7 @@ import { readFile, access } from "node:fs/promises";
|
|
|
5
5
|
import { join, dirname } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const __dirname = dirname(__filename);
|
|
8
|
+
const __dirname = import.meta.dir;
|
|
10
9
|
|
|
11
10
|
const COMMANDS = {
|
|
12
11
|
run: "Run the test UI (production mode)",
|
|
@@ -60,11 +59,12 @@ async function buildFrontend() {
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
async function checkBuildExists(): Promise<boolean> {
|
|
62
|
+
const distPath = join(__dirname, "app", "dist", "index.html");
|
|
63
63
|
try {
|
|
64
|
-
const distPath = join(__dirname, "app", "dist", "index.html");
|
|
65
64
|
await access(distPath);
|
|
66
65
|
return true;
|
|
67
66
|
} catch {
|
|
67
|
+
console.error(`Debug: Checked path not found: ${distPath}`);
|
|
68
68
|
return false;
|
|
69
69
|
}
|
|
70
70
|
}
|
package/package.json
CHANGED
package/ui-runner.ts
CHANGED
|
@@ -14,25 +14,21 @@
|
|
|
14
14
|
import { spawn } from "node:child_process";
|
|
15
15
|
import { readdir, readFile, stat } from "node:fs/promises";
|
|
16
16
|
import { join, relative, dirname } from "node:path";
|
|
17
|
-
import { fileURLToPath } from "node:url";
|
|
18
17
|
import { existsSync } from "node:fs";
|
|
19
18
|
|
|
20
19
|
// Determina o diretório do executável ou script
|
|
21
20
|
const getBaseDir = () => {
|
|
22
21
|
// Se rodando como executável compilado, pega o diretório onde o CLI foi instalado
|
|
23
|
-
// O executável fica na raiz do pacote, então app/dist fica relativo a ele
|
|
24
22
|
if (import.meta.path && !import.meta.path.endsWith('.ts')) {
|
|
25
|
-
// É um executável compilado - usa process.execPath (path real do executável)
|
|
26
|
-
// import.meta.path retorna um path virtual do bunfs
|
|
27
23
|
return dirname(process.execPath);
|
|
28
24
|
}
|
|
29
|
-
// Se rodando como script .ts
|
|
30
|
-
|
|
31
|
-
return dirname(__filename);
|
|
25
|
+
// Se rodando como script .ts, usa o dir do próprio arquivo
|
|
26
|
+
return import.meta.dir;
|
|
32
27
|
};
|
|
33
28
|
|
|
34
29
|
const baseDir = getBaseDir();
|
|
35
30
|
const distPath = join(baseDir, "app", "dist");
|
|
31
|
+
console.log(`Debug: distPath is ${distPath}`);
|
|
36
32
|
const isDevMode = process.env.BUN_TEST_UI_DEV === "true";
|
|
37
33
|
|
|
38
34
|
// WebSocket Handler (lógica compartilhada)
|