bun-ui-tests 1.0.10 → 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.
Files changed (2) hide show
  1. package/cli.ts +33 -8
  2. 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
- if (await Bun.file(runnerPath).exists() && await Bun.file(distPath).exists()) {
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
 
@@ -173,19 +183,34 @@ async function runTestUI() {
173
183
  console.log(`${colors.gray}--- Debug Information ---`);
174
184
  console.log(`Resolved Root: ${root}`);
175
185
  console.log(`import.meta.url: ${import.meta.url}`);
176
- console.log(`process.argv[1]: ${process.argv[1]}`);
177
- console.log(`process.cwd(): ${process.cwd()}`);
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
+ }
178
192
 
179
193
  try {
180
- console.log(`\nContents of ${root}:`);
194
+ console.log(`\nListing contents of ${root} (max 10):`);
181
195
  const entries = await readdir(root);
182
- console.log(entries.join("\n"));
196
+ console.log(entries.slice(0, 10).join("\n"));
197
+ if (entries.length > 10) console.log(`... and ${entries.length - 10} more`);
183
198
 
184
199
  const appPath = join(root, "app");
185
- if (await Bun.file(appPath).exists() || await Bun.file(join(appPath, "package.json")).exists()) {
186
- console.log(`\nContents of ${appPath}:`);
200
+ const appDistPath = join(appPath, "dist");
201
+
202
+ if (await Bun.file(appPath).exists()) {
203
+ console.log(`\nContents of app (max 10):`);
187
204
  const appEntries = await readdir(appPath);
188
- console.log(appEntries.join("\n"));
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
+ }
189
214
  }
190
215
  } catch (e) {
191
216
  console.log(`Error reading directory: ${e}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-ui-tests",
3
- "version": "1.0.10",
3
+ "version": "1.1.0",
4
4
  "description": "A beautiful UI for running Bun tests",
5
5
  "type": "module",
6
6
  "bin": {