Skip to content

Commit bcac26f

Browse files
committed
Merge remote-tracking branch 'ivarref/main'
2 parents 65be913 + 432882f commit bcac26f

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Resolve reflective calls in profiling plugin.
99
- Fix `kaocha.testable/test-seq` not respecting `:kaocha.testable/skip` on root testable
1010
- Fix `kaocha.testable/test-seq-with-skipped` omitting skipped tests on nested testables
11+
- `*.<ext>` will now match files with `.ext` extensions in any directory.
1112

1213
## Changed
1314

src/kaocha/watch.clj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@
8787
(assoc tracker ::tracker-error e)
8888
(throw e)))))
8989

90+
(defn- fix-pattern
91+
"beholder, the file change watcher, will always produce fully qualified paths.
92+
A '*.<ext>' pattern will never match anything.
93+
Such a pattern will be prefixed with '*'.
94+
This will cause the pattern to match all files ending in '.<ext>' in any directory."
95+
[pattern]
96+
(assert (string? pattern))
97+
(if (str/starts-with? pattern "*.")
98+
(str "*" pattern)
99+
pattern))
100+
90101
(defn glob?
91102
"Does path match any of the glob patterns.
92103
@@ -96,7 +107,7 @@
96107
[path patterns]
97108
(assert (instance? Path path))
98109
(let [fs (FileSystems/getDefault)
99-
patterns (map #(.getPathMatcher fs (str "glob:" %)) patterns)]
110+
patterns (map #(.getPathMatcher fs (str "glob:" (fix-pattern %))) patterns)]
100111
(some #(.matches ^PathMatcher % path) patterns)))
101112

102113
(defn convert

0 commit comments

Comments
 (0)