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(cli): Extend existing list command to output only a list of file names #6392

Merged
merged 18 commits into from
Aug 29, 2024

Conversation

Ma-hawaj
Copy link
Contributor

@Ma-hawaj Ma-hawaj commented Aug 25, 2024

  • feat(cli): add the files only option to the list command (unfuncitonal)
  • feat(cli): add implementation for listing files only
  • feat(cli): add testing for list --filesOnly
  • feat(cli): add documentation for list --filesOnly

Description

Extend existing list command to output only a list of file names

closes #6374

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 Aug 25, 2024

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 00445ab
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/66cdab99e92aef0008ed3a6a
😎 Deploy Preview https://deploy-preview-6392--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Ma-hawaj Ma-hawaj changed the title Extend existing list command to output only a list of file names feat(cli): Extend existing list command to output only a list of file names Aug 25, 2024
Copy link
Member

@sheremet-va sheremet-va left a comment

Choose a reason for hiding this comment

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

This implementation seems a bit pointless because you can do the same yourself on vitest list result.

What we need is to not collect tests at all to make this very fast. This line should just not be called:

await this.collectFiles(files)

@Ma-hawaj
Copy link
Contributor Author

Ma-hawaj commented Aug 26, 2024

OK,
so will adding the following

async listFiles(filters?: string[]) {
    const files = await this.filterTestsBySource(
      await this.globTestFiles(filters),
    )
    return files
}

in the vitest class and checking the option in cac.ts:collect() and calling it will do the job ?

Ma-hawaj and others added 2 commits August 27, 2024 12:39
Co-authored-by: Vladimir <sleuths.slews0s@icloud.com>
packages/vitest/src/node/cli/cli-api.ts Outdated Show resolved Hide resolved
packages/vitest/src/node/cli/cli-api.ts Outdated Show resolved Hide resolved
@sheremet-va sheremet-va merged commit 008f00b into vitest-dev:main Aug 29, 2024
14 of 15 checks passed
@sheremet-va
Copy link
Member

Thanks!

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.

Extend existing list command to output only a list of file names
2 participants