mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-04 17:34:49 -04:00
Use weighted algorithm for string matching when finding files in repo (#21370)
This PR is for: * https://github.com/go-gitea/gitea/issues/20231 Now, when a user searches `word`, they always see `/{word}.txt` before `/{w}e-g{o}t-{r}esult.{d}at` Demo: When searching "a", "a.ext" comes first. Then when searching "at", the longer matched "template" comes first. <details>   </details> This PR also makes the frontend tests could import feature JS files by introducing `jestSetup.js` Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
parent
7bb12d7efa
commit
768e16dad1
6 changed files with 118 additions and 71 deletions
|
@ -1,3 +1,4 @@
|
|||
// to run tests with ES6 module, node must run with "--experimental-vm-modules", or see Makefile's "test-frontend" for reference
|
||||
export default {
|
||||
rootDir: 'web_src',
|
||||
setupFilesAfterEnv: ['jest-extended/all'],
|
||||
|
@ -7,6 +8,8 @@ export default {
|
|||
transform: {
|
||||
'\\.svg$': '<rootDir>/js/testUtils/jestRawLoader.js',
|
||||
},
|
||||
setupFiles: [
|
||||
'./js/testUtils/jestSetup.js', // prepare global variables used by our code (eg: window.config)
|
||||
],
|
||||
verbose: false,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue