Skip to content

Commit

Permalink
chore: improve vitest output (#6850)
Browse files Browse the repository at this point in the history
* chore: improve vitest output

* chore: address comments

* chore: address comments
  • Loading branch information
jeluard committed Jun 5, 2024
1 parent 3a9efd2 commit def34eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions docs/pages/contribution/testing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ Testing is critical to the Lodestar project and there are many types of tests th

There are few flags you can set through env variables to override behavior of testing and it's output.

| ENV variable | Effect | Impact |
| ----------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| TEST_COMPACT_DIFF | All | Will strip down the object difference rendered during test failures. Very useful for large object matching. |
| ENV variable | Effect | Impact |
| ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| TEST_COMPACT_DIFF | All | Will strip down the object difference rendered during test failures. Very useful for large object matching. |
| TEST_QUIET_CONSOLE | All | Will strip down console output. Reduce console flickering. |
| TEST_COMPACT_OUTPUT | All | Display a condensed summary of tests run. Use vitest [basic](https://vitest.dev/guide/reporters#basic-reporter) reporter. |

### Unit Tests

Expand Down
3 changes: 2 additions & 1 deletion vitest.base.unit.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default defineConfig({
],
reporters: process.env.GITHUB_ACTIONS
? ["verbose", "hanging-process", "github-actions"]
: ["verbose", "hanging-process"],
: [process.env.TEST_COMPACT_OUTPUT ? "basic" : "verbose", "hanging-process"],
coverage: {
enabled: process.env.CI === "true",
clean: true,
Expand All @@ -46,5 +46,6 @@ export default defineConfig({
],
},
diff: process.env.TEST_COMPACT_DIFF ? path.join(import.meta.dirname, "./scripts/vitest/vitest.diff.ts") : undefined,
onConsoleLog: () => !process.env.TEST_QUIET_CONSOLE,
},
});

0 comments on commit def34eb

Please sign in to comment.