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): show test "path" when filtering #6649

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

userquin
Copy link
Member

@userquin userquin commented Oct 6, 2024

Description

This PR is related to filtering from command line here: #6641 (compare screenshots there and here)

This PR allows declare the watcher filter using a new interface to display the list with the test path removing duplicates files when using workspaces. Right now, filtering tests will run any test in any files and workspace matching the name of the selected item (test name).

NOTE: we should add a new runById to allow run only a test (the UI will use it)

filtering from command line with this PR

imagen

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:.

@userquin userquin marked this pull request as ready for review October 6, 2024 13:32
@userquin userquin changed the title feat(vitest): show test "path" when filtering feat(cli): show test "path" when filtering Oct 6, 2024
}
else {
for (const task of t.tasks) {
yield * traverseFilteredTestNames([...stack, task.name], filter, task)
Copy link
Member Author

Choose a reason for hiding this comment

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

add parentName: string instead recreating the array

Copy link
Member Author

@userquin userquin Oct 8, 2024

Choose a reason for hiding this comment

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

latest commit also fixes duplicate test names - check the screenshot, t1 appears twice

@@ -9,13 +9,18 @@ const MAX_RESULT_COUNT = 10
const SELECTION_MAX_INDEX = 7
const ESC = '\u001B['

type FilterFunc = (keyword: string) => Promise<string[]> | string[]
export interface FilterType {
Copy link
Member Author

@userquin userquin Oct 8, 2024

Choose a reason for hiding this comment

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

Rename this to FilterObject or FilterItem and replace name with key.

This way when we add the x command to run a test/suite we we just use key with the corresponding id.

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.

1 participant