-
-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: improve vitest output #6786
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #6786 +/- ##
============================================
+ Coverage 61.88% 62.20% +0.32%
============================================
Files 562 571 +9
Lines 59331 60015 +684
Branches 1916 1976 +60
============================================
+ Hits 36715 37335 +620
- Misses 22573 22637 +64
Partials 43 43 |
vitest.base.unit.config.ts
Outdated
@@ -20,7 +20,7 @@ export default defineConfig({ | |||
], | |||
reporters: process.env.GITHUB_ACTIONS | |||
? ["verbose", "hanging-process", "github-actions"] | |||
: ["verbose", "hanging-process"], | |||
: [process.env.TEST_COMPACT_OUTPUT === "true" ? "basic" : "verbose", "hanging-process"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need a more consistent approach on how we check env variables, something we check strictly for "true"
and other times we just check if the env variable is set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Any preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no hard opinion about it but what ever we do should do consistently. And if that rule can be enforced by linter then let it be individual choice.
vitest.base.unit.config.ts
Outdated
@@ -42,5 +42,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 !== "true", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be expensive check, as for every log message this function will be called. Not fully against it, but we should document somewhere that it's a expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be neglectable compared to the cost of logging a line to the console. I haven't notices any slowdown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be checking against "true"
here
Co-authored-by: Nazar Hussain <nazarhussain@gmail.com>
| 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. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you mean by "strip down" here? doesn't this disable console logging if set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's still the vitest
output, this disables lodestar
console output. Open to description clarifications.
vitest.base.unit.config.ts
Outdated
@@ -42,5 +42,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 !== "true", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be checking against "true"
here
* chore: upgrade classic-level * chore: address comments
…ainSafe#6727) * Restructure the assertions * Add an inspector to run the logic to detect providers * Update web3 provdier logic to use inspetor * Fix the types for proxy * Make the default type for mutation * Rename elrpc to elrpcprovider * Apply suggestions from code review Co-authored-by: Julien <jeluard@users.noreply.github.com> * Fix build error * Update the readme doc * Apply suggestions from code review Co-authored-by: Julien <jeluard@users.noreply.github.com> * Fix the docs linting * Add missing words --------- Co-authored-by: Julien <jeluard@users.noreply.github.com>
* docs: added debugging section * chore: spell checks * chore: added extra docs * chore: address comments * chore: added extra configuration * chore: updated docs * chore: added extra configuration * chore: fix lint * chore: fix typos * chore: .gitignore * chore: address comments * chore: address comments
* Rename simulation test to crucible * Rename SimulationEnvironment to Simulation * Use consistent function names * Update readme * Rename interfaces for consistent pattern * Fix lint error
* Add grandine * add grandine to wordlist
* chore: refactor sleep(0) usage * chore: refactor setTimeout * chore: address comments * chore: cleanup * Apply suggestions from code review --------- Co-authored-by: Cayman <caymannava@gmail.com>
…afe#6814) * Check get_proposer_head * Fix enum typo * lint
* chore: do not rely on leveldown * chore: replace level with classic-level
* chore: added docker support for osx * chore: address comments * chore: address comments * Update docker-compose.yml Co-authored-by: Nico Flaig <nflaig@protonmail.com> * chore: address comments --------- Co-authored-by: Nico Flaig <nflaig@protonmail.com>
…inSafe#6817) Fix vitest performance with spec tests in place
* feat: use @chainsafe/blst directly * chore: update to blst@1.0.1 * refactor: remove randomBytesNonZero and user blst exported version * chore: update blst references * test: catch invalid deserialization in spec tests and return false * feat: create signatureFromBytes and signatureFromBytesNoCheck in utils package * feat: implement signatureFromBytes from utils package * feat: implement signatureFromBytes everywhere * fix: light-client empty module for blst --------- Co-authored-by: matthewkeil <me@matthewkeil.com>
* fix: avoid Buffer.from copies * chore: simplify shuffling * fix: use subarray instead of slice in shuffling * chore: remove unnecessary devDependencies * chore: rely on fastify 4.x behavior * chore: avoid copy in verifyMerkleBranch * use toBase64 * relax assertions in shuffle function * Update packages/state-transition/src/util/shuffle.ts Co-authored-by: twoeths <tuyen@chainsafe.io> --------- Co-authored-by: twoeths <tuyen@chainsafe.io>
* Upgrade node js version to 22 * Update node types * Revert action config * Add package from git hash * Fix the build error * Update the docs for node-22 * Update docker version for Nodejs to 22 * Update package.json * Update package.json Co-authored-by: Nico Flaig <nflaig@protonmail.com> * Update readme docs * Add word in dictionary * Add word in dictionary --------- Co-authored-by: Cayman <caymannava@gmail.com> Co-authored-by: Nico Flaig <nflaig@protonmail.com>
* test: increase timeout of keystore cache tests * Increase hook timeout * Consistent number formatting
Replaced by #6850 |
Motivation
Current tests output can be quite verbose, and display interleaved
console
output.Description
Default behavior is unchanged. 2 env variables allow to tweak
vitest
output:TEST_COMPACT_OUTPUT
to produce a basic tests summaryTEST_QUIET_CONSOLE
to strip console output from tests summarye.g.
TEST_QUIET_CONSOLE=true TEST_COMPACT_OUTPUT=true yarn test:spec:mainnet
will produce the following output: