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

Fuzzy Search #19

Open
reyronald opened this issue Jul 11, 2018 · 7 comments · May be fixed by #137
Open

Fuzzy Search #19

reyronald opened this issue Jul 11, 2018 · 7 comments · May be fixed by #137

Comments

@reyronald
Copy link

So I've been waiting for the type-ahead to come back ever since it was removed a few versions ago so that I could propose a Fuzzy Search filtering in addition of (or replacement?) the already existing ones. I searched through the jest and this repo's issues and I've seen a few mentions of it but no formal discussion.

Implementing it is sort-of straightforward since all the heavy lifting is already in place so I thought to give it a shot to have something to show on this issue, what I have in mind could look something like this:

jest fuzzy typeahead

Most developers are already familiar with the UX surrounding fuzzy searching and personally I would find it more useful than the regex ones in most cases, if not all.

So what does the team think? Is this something that could be included in this repo's roadmap? I volunteer to work on this if it is.

/cc @cpojer

@rogeliog
Copy link
Member

Yes! This is definitely on the roadmap. I was working on a PR for generalizing some of it to support globs, but the idea is that we should be able to support different search strategies. More info here #15

Since Jest 23.3 plugins can be configured, so I was thinking that it would result in a config like this.

"watchPlugins": [
  [jest-plugin-filename, { "filter": "fuzzy" }]
],

@reyronald
Copy link
Author

Cool! I definitely see glob filtering being very useful as well! Hadn't occurred to me.

What's cool about fuzzy is that it can be re-used maybe identically for the testname / testsuite plug-in too.

If you get the configuration system alone merged before advancing a lot of work into some of the specific search strategies perhaps we could work together in the glob and fuzzy ones in parallel and get them to ship quicker and in the same release. Let me know if you are interested.

And by the way, great work on the typeahead feature! It's one of my favorite things about Jest! 😍

@unional
Copy link

unional commented Oct 6, 2018

"watchPlugins": [ [jest-plugin-filename, { "filter": "fuzzy" }] ],

That would limit the filter to "fuzzy", maybe making it an object?

"watchPlugins": [
  ["jest-watch-typeahead", { 
    "filename": true | {  ...filename matching config... },
    "testname": true | { ...testname matching config... },
    "fuzzy": true | { ...fuzzy config... }
  }]
]

@larrybotha
Copy link

Any progress or interest in this? This would save a massive amount of time finding tests in deeply nested paths.

@SimenB
Copy link
Member

SimenB commented Aug 12, 2020

PR welcome 🙂

@Andarist
Copy link
Contributor

Andarist commented Dec 1, 2020

@SimenB do you think the fuzzy algorithm should become the default? My personal take on this would be that - yes, it would be great as a default. Not sure how do you feel about it though.

I've looked at how VSCode handles this and it seems that they have a custom implementation:

I'm not really up to implementing still like this - I would much more prefer to just outsource this quickly to a handy npm package 😅 I've found this fuzzysearch and its implementation os very similar (but not the same) as the one in VSCode's fuzzyContains. Thoughts?

@cpojer
Copy link

cpojer commented Dec 1, 2020

Yes, fuzzy search should be the default! Send a PR :)

@aymericbouzy aymericbouzy linked a pull request Mar 21, 2022 that will close this issue
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 a pull request may close this issue.

7 participants