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

feat: add blob reporter #5663

Merged
merged 33 commits into from May 14, 2024
Merged

Conversation

sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented May 3, 2024

Description

For now, it's a json file with all results. If we keep it that way, then maybe we should rename the reporter.

Run vitest --reporter=blob --outputFile=reports/blob1.json to record all test runs
Run vitest --merge-reports=reports to report all test runs

TODO:

  • Tests
  • Docs

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 May 3, 2024

Deploy Preview for fastidious-cascaron-4ded94 canceled.

Name Link
🔨 Latest commit eec9b17
🔍 Latest deploy log https://app.netlify.com/sites/fastidious-cascaron-4ded94/deploys/663cbecdf1d8fb0008ccde0c

@sheremet-va sheremet-va added this to the 2.0.0 milestone May 3, 2024
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for starting the implementation for this! I've been meaninig to look into this for long time but haven't found time for it. 🙌

Some quick comments below.

docs/guide/cli-table.md Outdated Show resolved Hide resolved
packages/vitest/src/node/reporters/blob.ts Outdated Show resolved Hide resolved
packages/vitest/src/node/reporters/blob.ts Outdated Show resolved Hide resolved
@sheremet-va sheremet-va force-pushed the feat/blob-reporter branch 2 times, most recently from 9332873 to 75f9aa1 Compare May 8, 2024 16:39
@sheremet-va sheremet-va marked this pull request as ready for review May 9, 2024 11:56
Copy link
Member

@AriPerkkio AriPerkkio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. As test case we could have something like:

test('merge reports', async () => {
  await runVitest({
    include: ['**/first.test.ts'],
    reporters: [['blob', { outputFile: './vitest-reports/first-run.json' }]],
  })
  await runVitest({
    include: ['**/second.test.ts'],
    reporters: [['blob', { outputFile: './vitest-reports/second-run.json' }]],
  })

  const { stdout } = await runVitest({
    mergeReports: './vitest-reports',
    reporters: [['json', { outputFile: null }]], // JSON report to stdout
  })

  expect(stdout)...
})

And later we should set up an example project maybe in the vitest-tests organization demonstrating how to use --shard and mergeReports with multiple CI machines.

packages/vitest/src/node/core.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Looks good to go after checking test and doc.

@sheremet-va sheremet-va merged commit e20538a into vitest-dev:main May 14, 2024
16 checks passed
@sheremet-va sheremet-va deleted the feat/blob-reporter branch May 14, 2024 16:57
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.

None yet

3 participants