Skip to content
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

fix(benchmark): table reporter for non TTY output #5484

Merged
merged 7 commits into from Apr 6, 2024

Conversation

hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Apr 4, 2024

Description

This PR implements "non incremental" table output for non TTY case by reusing benchmark renderTree.

The idea is similar to verbose test reporter, which uses onTaskUpdate and waits until status is ready task.result?.state !== 'run' then print a full result:

onTaskUpdate(packs: TaskResultPack[]) {
if (this.isTTY)
return
for (const pack of packs) {
const task = this.ctx.state.idMap.get(pack[0])
if (task && task.type === 'test' && task.result?.state && task.result?.state !== 'run') {
let title = ` ${getStateSymbol(task)} `

Reveal screenshots
  • tty

image

  • no tty

image

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Copy link

netlify bot commented Apr 4, 2024

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
🔨 Latest commit 97734d9
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/6610a6419f8ef200086e2323

@hi-ogawa hi-ogawa changed the title fix(benchmark): print table on non TTY output fix(benchmark): table reporter for non TTY output Apr 4, 2024
@hi-ogawa hi-ogawa marked this pull request as ready for review April 4, 2024 10:41
sheremet-va
sheremet-va previously approved these changes Apr 5, 2024
@sheremet-va
Copy link
Member

Can you resolve the conflict, please?

@sheremet-va sheremet-va merged commit bea234b into vitest-dev:main Apr 6, 2024
18 of 19 checks passed
@hi-ogawa hi-ogawa deleted the fix-non-tty-bench-table branch April 6, 2024 07:57
renovate bot added a commit to solid-design-system/solid that referenced this pull request Apr 11, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[vite-node](https://togithub.com/vitest-dev/vitest/blob/main/packages/vite-node#readme)
([source](https://togithub.com/vitest-dev/vitest/tree/HEAD/packages/vite-node))
| [`1.4.0` ->
`1.5.0`](https://renovatebot.com/diffs/npm/vite-node/1.4.0/1.5.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/vite-node/1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/vite-node/1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/vite-node/1.4.0/1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vite-node/1.4.0/1.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>vitest-dev/vitest (vite-node)</summary>

###
[`v1.5.0`](https://togithub.com/vitest-dev/vitest/releases/tag/v1.5.0)

[Compare
Source](https://togithub.com/vitest-dev/vitest/compare/v1.4.0...v1.5.0)

#####    🚀 Features

- Add configuration for diff truncation  -  by
[@&#8203;willieho](https://togithub.com/willieho) in
[vitest-dev/vitest#5073
and
[vitest-dev/vitest#5333
[<samp>(6797b)</samp>](https://togithub.com/vitest-dev/vitest/commit/6797b041)
- Remove unrelated noise from diff for toMatchObject()  -  by
[@&#8203;geersch](https://togithub.com/geersch) in
[vitest-dev/vitest#5364
[<samp>(99276)</samp>](https://togithub.com/vitest-dev/vitest/commit/99276399)
- Allow custom host for --inspect and --inspect-brk  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#5509
[<samp>(61572)</samp>](https://togithub.com/vitest-dev/vitest/commit/6157282c)
- **coverage**: V8 to ignore empty lines, comments, types  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#5457
[<samp>(10b89)</samp>](https://togithub.com/vitest-dev/vitest/commit/10b89713)

#####    🐞 Bug Fixes

- `describe` calls not taking generic type parameters  -  by
[@&#8203;aryaemami59](https://togithub.com/aryaemami59) in
[vitest-dev/vitest#5415
[<samp>(16bac)</samp>](https://togithub.com/vitest-dev/vitest/commit/16bacfab)
- Prevent hang when `process` is mocked  -  by
[@&#8203;AriPerkkio](https://togithub.com/AriPerkkio) in
[vitest-dev/vitest#5430
[<samp>(0ec4d)</samp>](https://togithub.com/vitest-dev/vitest/commit/0ec4d0e0)
- Don't check for "node:internal/console/" in console interceptor in
case the environment is not Node.js  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va)
[<samp>(87d36)</samp>](https://togithub.com/vitest-dev/vitest/commit/87d36a7a)
- The value received by toMatch should be a string  -  by
[@&#8203;btea](https://togithub.com/btea) in
[vitest-dev/vitest#5428
[<samp>(67485)</samp>](https://togithub.com/vitest-dev/vitest/commit/674851ca)
- Increase stack trace limit for location, don't hardcode suite position
 -  by [@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#5518
[<samp>(04b23)</samp>](https://togithub.com/vitest-dev/vitest/commit/04b234d1)
-   **benchmark**:
- Run benchmark suites sequentially  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#5444
[<samp>(1f548)</samp>](https://togithub.com/vitest-dev/vitest/commit/1f548340)
- Fix benchmark summary of single bench suite  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#5489
[<samp>(db981)</samp>](https://togithub.com/vitest-dev/vitest/commit/db98145f)
- Table reporter for non TTY output  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#5484
[<samp>(bea23)</samp>](https://togithub.com/vitest-dev/vitest/commit/bea234b1)
-   **expect**:
- Fix `toHaveBeenNthCalledWith` error message when not called  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#5420
[<samp>(e5253)</samp>](https://togithub.com/vitest-dev/vitest/commit/e5253de4)
-   **types**:
- Pass correct type for suite factory  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#5437
[<samp>(26718)</samp>](https://togithub.com/vitest-dev/vitest/commit/26718eb5)
-   **utils**:
- Fix object diff with getter only property  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#5466
[<samp>(366d9)</samp>](https://togithub.com/vitest-dev/vitest/commit/366d97c3)
-   **vite-node**:
- Fix `isValidNodeImport` to check `"type": "module"` first  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#5416
[<samp>(6fb15)</samp>](https://togithub.com/vitest-dev/vitest/commit/6fb15280)
-   **vitest**:
- Correctly send console events when state changes  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va)
[<samp>(3463f)</samp>](https://togithub.com/vitest-dev/vitest/commit/3463f9bb)
- Initiate FakeTimers on demand  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#5450
[<samp>(e4e93)</samp>](https://togithub.com/vitest-dev/vitest/commit/e4e939ba)
- Check unhighlighted code for code frame line limit  -  by
[@&#8203;hi-ogawa](https://togithub.com/hi-ogawa) in
[vitest-dev/vitest#5465
[<samp>(6ae7e)</samp>](https://togithub.com/vitest-dev/vitest/commit/6ae7eaa2)
- Correctly filter by parent folder  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#5408
[<samp>(91b06)</samp>](https://togithub.com/vitest-dev/vitest/commit/91b06cce)
- Close inspector immediately if run is canceled  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#5519
[<samp>(b8006)</samp>](https://togithub.com/vitest-dev/vitest/commit/b80062d7)
-   **workspace**:
- Set CWD to config directory, allow overriding local .env  -  by
[@&#8203;sheremet-va](https://togithub.com/sheremet-va) in
[vitest-dev/vitest#5476
[<samp>(d4003)</samp>](https://togithub.com/vitest-dev/vitest/commit/d4003882)

#####     [View changes on
GitHub](https://togithub.com/vitest-dev/vitest/compare/v1.4.0...v1.5.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 5am every weekday" in timezone
Europe/Berlin, Automerge - "after 10pm every weekday,before 5am every
weekday" in timezone Europe/Berlin.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/solid-design-system/solid).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Benchmark doesn't print a table if terminal doesn't support TTY (in CI for example)
2 participants