Skip to content

Support globs, regexes and other search strategies #15

Open
@rogeliog

Description

There are a couple of issues in facebook/jest that propose the idea of supporting globs as a filtering mechanism. For example jestjs/jest#6422 and jestjs/jest#926

Now that configs for watch plugins got released, I think we can leverage that.

"watchPlugins": [
  ["jest-watch-typeahead/filename", {
     "key": "g",
    "filter": "glob",
    "prompt": "filter by glob"
  }]
]

The implementation should not be that hard, given that we can use shouldRunTestSuite for it, it does come with a couple of problems though.

  • testPathPattern is a regex, which means that we would need to rely on shouldRunTestSuite when using a "filter" type that is not regex.
    • This means that pressing "c" to clear would only work when using regex. I think this is fine, we can show a stlightly different UI for the typeahead when it is not a regex for supporting that.
          > Press "g" to filter by glob (current filter "**/e2e/**/*.js")
      
      This is similar to how the jest-watch-select-projects work. Althought we would also need another UI tweak to clear the filter

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions