-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow configuring run summary logging behavior
Motivation: Logging every 5 seconds is very verbose for long tests. Modifications: - Allow disabling run summary logging entirely. - Allow configuring the run summary refresh interval, with the ability to switch to a longer interval after a certain time. Result: Less verbose logs (both by default or depending on configuration).
- Loading branch information
Showing
11 changed files
with
221 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { formatErrorMessage } from "./error"; | ||
export { formatDuration } from "./duration"; | ||
export { formatDuration, formatDurationDiff } from "./duration"; | ||
|
||
export * as console from "./console"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
import { expect, test } from "@jest/globals"; | ||
import { formatDuration } from "@src/utils/duration"; | ||
import { formatDurationDiff } from "@src/utils/duration"; | ||
|
||
test("formatDuration d/h/m/s", () => { | ||
const start = new Date(2022, 12, 14, 7, 52, 15, 0).getTime(); | ||
const end = new Date(2022, 12, 16, 10, 13, 52, 12).getTime(); | ||
expect(formatDuration(start, end)).toBe("2d 2h 21m 37s"); | ||
expect(formatDurationDiff(start, end)).toBe("2d 2h 21m 37s"); | ||
}); | ||
|
||
test("formatDuration d/h/m/s with exact day", () => { | ||
const start = new Date(2022, 12, 14, 7, 52, 15, 24).getTime(); | ||
const end = new Date(2022, 12, 16, 7, 52, 15, 29).getTime(); | ||
expect(formatDuration(start, end)).toBe("2d 0h 0m 0s"); | ||
expect(formatDurationDiff(start, end)).toBe("2d 0h 0m 0s"); | ||
}); | ||
|
||
test("formatDuration h/m/s", () => { | ||
const start = new Date(2022, 12, 14, 7, 52, 15, 0).getTime(); | ||
const end = new Date(2022, 12, 15, 7, 13, 52, 12).getTime(); | ||
expect(formatDuration(start, end)).toBe("23h 21m 37s"); | ||
expect(formatDurationDiff(start, end)).toBe("23h 21m 37s"); | ||
}); | ||
|
||
test("formatDuration h/m/s with exact hour", () => { | ||
const start = new Date(2022, 12, 14, 7, 52, 15, 0).getTime(); | ||
const end = new Date(2022, 12, 15, 5, 52, 15, 12).getTime(); | ||
expect(formatDuration(start, end)).toBe("22h 0m 0s"); | ||
expect(formatDurationDiff(start, end)).toBe("22h 0m 0s"); | ||
}); | ||
|
||
test("formatDuration m/s", () => { | ||
const start = new Date(2022, 12, 14, 7, 13, 52, 12).getTime(); | ||
const end = new Date(2022, 12, 14, 7, 52, 15, 0).getTime(); | ||
expect(formatDuration(start, end)).toBe("38m 22s"); | ||
expect(formatDurationDiff(start, end)).toBe("38m 22s"); | ||
}); | ||
|
||
test("formatDuration m/s with exact minute", () => { | ||
const start = new Date(2022, 12, 14, 7, 13, 25, 58).getTime(); | ||
const end = new Date(2022, 12, 14, 7, 51, 26, 5).getTime(); | ||
expect(formatDuration(start, end)).toBe("38m 0s"); | ||
expect(formatDurationDiff(start, end)).toBe("38m 0s"); | ||
}); | ||
|
||
test("formatDuration s", () => { | ||
const start = new Date(2022, 12, 14, 7, 51, 52, 12).getTime(); | ||
const end = new Date(2022, 12, 14, 7, 52, 15, 0).getTime(); | ||
expect(formatDuration(start, end)).toBe("22s"); | ||
expect(formatDurationDiff(start, end)).toBe("22s"); | ||
}); | ||
|
||
test("formatDuration zero duration", () => { | ||
const start = new Date(2022, 12, 14, 7, 52, 15, 0).getTime(); | ||
const end = new Date(2022, 12, 14, 7, 52, 15, 0).getTime(); | ||
expect(formatDuration(start, end)).toBe("0s"); | ||
expect(formatDurationDiff(start, end)).toBe("0s"); | ||
}); | ||
|
||
test("formatDuration negative duration", () => { | ||
const start = new Date(2022, 12, 14, 7, 52, 15, 0).getTime(); | ||
const end = new Date(2022, 12, 14, 7, 52, 14, 0).getTime(); | ||
expect(() => formatDuration(start, end)).toThrow(); | ||
expect(() => formatDurationDiff(start, end)).toThrow(); | ||
}); |
Oops, something went wrong.