Skip to content

Commit

Permalink
test: update format of writing logs message in E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbbot committed Feb 2, 2024
1 parent 5c4539d commit f9adee9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/wrangler/e2e/dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,14 +489,14 @@ describe("writes debug logs to hidden file", () => {
async (session) => {
await waitForPortToBeBound(session.port);

await waitUntilOutputContains(session, "🐛 Writing debug logs to");
await waitUntilOutputContains(session, "Writing logs to");

await setTimeout(1000); // wait a bit to ensure the file is written to disk
}
);

const filepath = finalA.stdout.match(
/🐛 Writing debug logs to "(.+\.log)"/
/🪵 {2}Writing logs to "(.+\.log)"/
)?.[1];
assert(filepath);

Expand All @@ -511,7 +511,7 @@ describe("writes debug logs to hidden file", () => {
});

const filepath = finalA.stdout.match(
/🐛 Writing debug logs to "(.+\.log)"/
/🪵 {2}Writing logs to "(.+\.log)"/
)?.[1];

expect(filepath).toBeUndefined();
Expand Down
10 changes: 6 additions & 4 deletions packages/wrangler/e2e/helpers/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ export function normalizeTempDirs(stdout: string): string {
* Debug log files are created with a timestamp, so we replace the debug log filepath timestamp with <TIMESTAMP>
*/
export function normalizeDebugLogFilepath(stdout: string): string {
return stdout.replace(
/(🐛 Writing debug logs to ".+wrangler-debug)-.+\.log/,
"$1-<TIMESTAMP>.log"
);
return stdout
.replace(/🪵 {2}Writing logs to ".+\.log"/, '🪵 Writing logs to "<LOG>"')
.replace(
/🪵 {2}Logs were written to ".+\.log"/,
'🪵 Logs were written to "<LOG>"'
);
}

/**
Expand Down

0 comments on commit f9adee9

Please sign in to comment.