Clicking a link in the HTML reporter does exact filtering

This feature requires an update to boot1.js, as shown in this commit.
Users with an older boot1.js will get the older inexact filtering.
This commit is contained in:
Steve Gravrock
2025-09-16 21:03:16 -07:00
parent 4ccc7bf3ac
commit 8309416cb2
10 changed files with 231 additions and 52 deletions

View File

@@ -0,0 +1,38 @@
jasmineRequire.HtmlExactSpecFilter = function() {
class HtmlExactSpecFilter {
#getFilterString;
constructor(options) {
if (typeof options?.filterString !== 'function') {
throw new Error('options.filterString must be a function');
}
this.#getFilterString = options.filterString;
}
matches(spec) {
const filterString = this.#getFilterString();
if (!filterString) {
return true;
}
const filterPath = JSON.parse(this.#getFilterString());
const specPath = spec.getPath();
if (filterPath.length > specPath.length) {
return false;
}
for (let i = 0; i < filterPath.length; i++) {
if (specPath[i] !== filterPath[i]) {
return false;
}
}
return true;
}
}
return HtmlExactSpecFilter;
};