Skip to content

Commit

Permalink
refactor(betterer 🔧): improve test logging
Browse files Browse the repository at this point in the history
  • Loading branch information
phenomnomnominal committed Sep 15, 2024
1 parent 2de4730 commit fac5b17
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
4 changes: 3 additions & 1 deletion packages/fixture/src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ function isFiltered(str: string, options: FixtureOptions): boolean {
return filters.some((filter) => !!filter.exec(str));
}

// If a log contains *any* \ characters, swap it with /, regardless of OS.
// This has some false negative, but it just makes it easier.
function normaliseSlashes(line: string): string {
return line.split(path.sep).join(path.posix.sep);
return line.split(path.win32.sep).join(path.posix.sep);
}
4 changes: 2 additions & 2 deletions test/__snapshots__/styelint.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Error: "stylelint" got worse. (2 new issues, 2 existing, 4 total) 😔
・ 12 | b & {}
・ 13 | & b {}
・ > 14 | &:hover {}
・ | ^ Expected rule with selector matching "/^&:\\w/" to come before rule with selector matching "/^&/" (order/order)
・ | ^ Expected rule with selector matching "/^&:/w/" to come before rule with selector matching "/^&/" (order/order)
・ 15 | }
・ 16 |
・ 17 | .foo {
Expand All @@ -73,7 +73,7 @@ Error: "stylelint" got worse. (2 new issues, 2 existing, 4 total) 😔
12 | b & {}
13 | & b {}
> 14 | &:hover {}
| ^ Expected rule with selector matching "/^&:\\w/" to come before rule with selector matching "/^&/" (order/order)
| ^ Expected rule with selector matching "/^&:/w/" to come before rule with selector matching "/^&/" (order/order)
15 | }
・ 16 |
・ 17 | .foo {
Expand Down
36 changes: 18 additions & 18 deletions test/cli/__snapshots__/logo-show.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,57 +20,57 @@ exports[`betterer cli > should show the logo 1`] = `
1 test got checked for the first time! 🎉
",
"
\\ | / _ _ _
/ | / _ _ _
'-.ooo.-' | |__ ___| |_| |_ ___ _ __ ___ _ __
---ooooo--- | '_ \\/ _ \\ __| __/ _ \\ '__/ _ \\ '__|
---ooooo--- | '_ // _ / __| __/ _ / '__/ _ / '__|
.-'ooo'-. | |_)| __/ |_| || __/ | | __/ |
/ | \\ |_.__/\\___|\\__|\\__\\___|_| \\___|_|
/ | / |_.__//___|/__|/__/___|_| /___|_|
",
"
\\ | / _ _ _
/ | / _ _ _
'-.ooo.-' | |__ ___| |_| |_ ___ _ __ ___ _ __
---ooooo--- | '_ \\/ _ \\ __| __/ _ \\ '__/ _ \\ '__|
---ooooo--- | '_ // _ / __| __/ _ / '__/ _ / '__|
.-'ooo'-. | |_)| __/ |_| || __/ | | __/ |
/ | \\ |_.__/\\___|\\__|\\__\\___|_| \\___|_|
/ | / |_.__//___|/__|/__/___|_| /___|_|
🌟 Betterer (0ms):
",
"
\\ | / _ _ _
/ | / _ _ _
'-.ooo.-' | |__ ___| |_| |_ ___ _ __ ___ _ __
---ooooo--- | '_ \\/ _ \\ __| __/ _ \\ '__/ _ \\ '__|
---ooooo--- | '_ // _ / __| __/ _ / '__/ _ / '__|
.-'ooo'-. | |_)| __/ |_| || __/ | | __/ |
/ | \\ |_.__/\\___|\\__|\\__\\___|_| \\___|_|
/ | / |_.__//___|/__|/__/___|_| /___|_|
🌟 Betterer (0ms): 1 test running...
🤔 test 1: running "test 1"!
",
"
\\ | / _ _ _
/ | / _ _ _
'-.ooo.-' | |__ ___| |_| |_ ___ _ __ ___ _ __
---ooooo--- | '_ \\/ _ \\ __| __/ _ \\ '__/ _ \\ '__|
---ooooo--- | '_ // _ / __| __/ _ / '__/ _ / '__|
.-'ooo'-. | |_)| __/ |_| || __/ | | __/ |
/ | \\ |_.__/\\___|\\__|\\__\\___|_| \\___|_|
/ | / |_.__//___|/__|/__/___|_| /___|_|
🌟 Betterer (0ms): 1 test running...
✅ test 1: "test 1" stayed the same. 😐
",
"
\\ | / _ _ _
/ | / _ _ _
'-.ooo.-' | |__ ___| |_| |_ ___ _ __ ___ _ __
---ooooo--- | '_ \\/ _ \\ __| __/ _ \\ '__/ _ \\ '__|
---ooooo--- | '_ // _ / __| __/ _ / '__/ _ / '__|
.-'ooo'-. | |_)| __/ |_| || __/ | | __/ |
/ | \\ |_.__/\\___|\\__|\\__\\___|_| \\___|_|
/ | / |_.__//___|/__|/__/___|_| /___|_|
🎉 Betterer (0ms): 1 test done!
✅ test 1: "test 1" stayed the same. 😐
",
"
\\ | / _ _ _
/ | / _ _ _
'-.ooo.-' | |__ ___| |_| |_ ___ _ __ ___ _ __
---ooooo--- | '_ \\/ _ \\ __| __/ _ \\ '__/ _ \\ '__|
---ooooo--- | '_ // _ / __| __/ _ / '__/ _ / '__|
.-'ooo'-. | |_)| __/ |_| || __/ | | __/ |
/ | \\ |_.__/\\___|\\__|\\__\\___|_| \\___|_|
/ | / |_.__//___|/__|/__/___|_| /___|_|
🎉 Betterer (0ms): 1 test done!
✅ test 1: "test 1" stayed the same. 😐
Expand Down

0 comments on commit fac5b17

Please sign in to comment.