Skip to content

Commit

Permalink
Fix an showing 1 test when no tests are in the file
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihweiLHBird committed Nov 4, 2024
1 parent ee1ab4b commit 9ea9a5f
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions packages/winglang/src/commands/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,10 @@ export async function renderTestReport(
0
);

// if there are no inflight tests, add a dummy "pass" result
// return early if there are no tests, return a pass output
// to indicate that compilation and preflight checks passed
if (results.length === 0) {
results.push({
pass: true,
path: "",
traces: [],
});
return `${chalk.green("pass")}${basename(entrypoint)} ${chalk.gray("(no tests)")}`;
}

for (const result of results.sort(sortTests)) {
Expand Down Expand Up @@ -307,13 +303,8 @@ export async function renderTestReport(
}

firstRow.push(basename(entrypoint));

if (result.path?.length > 0) {
firstRow.push(chalk.gray("»"));
firstRow.push(chalk.whiteBright(result.path.padEnd(longestPath)));
} else {
firstRow.push(chalk.gray("(no tests)"));
}
firstRow.push(chalk.gray("»"));
firstRow.push(chalk.whiteBright(result.path.padEnd(longestPath)));

// okay we are ready to print the test result

Expand Down

0 comments on commit 9ea9a5f

Please sign in to comment.