bun-ui-tests 1.0.9 → 1.1.0
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 +48 -1
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -100,14 +100,21 @@ async function findVerifiedRoot(): Promise<string> {
|
|
|
100
100
|
dirname(fileURLToPath(import.meta.url)),
|
|
101
101
|
];
|
|
102
102
|
|
|
103
|
+
// Debug log para rastrear a decisão
|
|
104
|
+
const checkedPaths: string[] = [];
|
|
105
|
+
|
|
103
106
|
for (const root of possibleRoots) {
|
|
104
107
|
if (!root) continue;
|
|
105
108
|
const runnerPath = join(root, "ui-runner.ts");
|
|
106
109
|
const distPath = join(root, "app", "dist", "index.html");
|
|
107
110
|
|
|
108
|
-
|
|
111
|
+
const runnerExists = await Bun.file(runnerPath).exists();
|
|
112
|
+
const distExists = await Bun.file(distPath).exists();
|
|
113
|
+
|
|
114
|
+
if (runnerExists && distExists) {
|
|
109
115
|
return root;
|
|
110
116
|
}
|
|
117
|
+
checkedPaths.push(`${root} (runner: ${runnerExists}, dist: ${distExists})`);
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
// Fallback: search in global cache
|
|
@@ -128,6 +135,9 @@ async function findVerifiedRoot(): Promise<string> {
|
|
|
128
135
|
}
|
|
129
136
|
} catch (e) {}
|
|
130
137
|
|
|
138
|
+
// Salva os caminhos verificados no objeto global para debug
|
|
139
|
+
(globalThis as any)._debugCheckedPaths = checkedPaths;
|
|
140
|
+
|
|
131
141
|
return getPackageRoot();
|
|
132
142
|
}
|
|
133
143
|
|
|
@@ -169,6 +179,43 @@ async function runTestUI() {
|
|
|
169
179
|
console.log(" 1. The package wasn't built before publishing");
|
|
170
180
|
console.log(" 2. You're running from source (run: bun run build first)");
|
|
171
181
|
console.log(" 3. Installation issue\n");
|
|
182
|
+
|
|
183
|
+
console.log(`${colors.gray}--- Debug Information ---`);
|
|
184
|
+
console.log(`Resolved Root: ${root}`);
|
|
185
|
+
console.log(`import.meta.url: ${import.meta.url}`);
|
|
186
|
+
|
|
187
|
+
const checkedPaths = (globalThis as any)._debugCheckedPaths || [];
|
|
188
|
+
if (checkedPaths.length > 0) {
|
|
189
|
+
console.log("Checked Paths:");
|
|
190
|
+
checkedPaths.forEach((p: string) => console.log(` - ${p}`));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
console.log(`\nListing contents of ${root} (max 10):`);
|
|
195
|
+
const entries = await readdir(root);
|
|
196
|
+
console.log(entries.slice(0, 10).join("\n"));
|
|
197
|
+
if (entries.length > 10) console.log(`... and ${entries.length - 10} more`);
|
|
198
|
+
|
|
199
|
+
const appPath = join(root, "app");
|
|
200
|
+
const appDistPath = join(appPath, "dist");
|
|
201
|
+
|
|
202
|
+
if (await Bun.file(appPath).exists()) {
|
|
203
|
+
console.log(`\nContents of app (max 10):`);
|
|
204
|
+
const appEntries = await readdir(appPath);
|
|
205
|
+
console.log(appEntries.slice(0, 10).join("\n"));
|
|
206
|
+
|
|
207
|
+
if (await Bun.file(appDistPath).exists()) {
|
|
208
|
+
console.log(`\nContents of app/dist (max 10):`);
|
|
209
|
+
const distEntries = await readdir(appDistPath);
|
|
210
|
+
console.log(distEntries.slice(0, 10).join("\n"));
|
|
211
|
+
} else {
|
|
212
|
+
console.log(`\napp/dist does not exist at ${appDistPath}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
} catch (e) {
|
|
216
|
+
console.log(`Error reading directory: ${e}`);
|
|
217
|
+
}
|
|
218
|
+
console.log(`-------------------------${colors.reset}\n`);
|
|
172
219
|
|
|
173
220
|
process.exit(1);
|
|
174
221
|
}
|