Skip to content

Commit 68803b6

Browse files
authored
fix: use accurate test links in HTML reporter (#5228)
- Add '^' and ' ' for a suite link so that a link for `Case1` won't hit `Case10 test1`. - Add '^' and '$' for a test link so that a link for `CSS` won't hit `should fix invalid CSS`.
1 parent d8ca270 commit 68803b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/reporters/html.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ function makeUrl(s) {
294294
window.location.pathname +
295295
(search ? search + '&' : '?') +
296296
'grep=' +
297-
encodeURIComponent(escapeRe(s))
297+
encodeURIComponent(s)
298298
);
299299
}
300300

@@ -304,7 +304,7 @@ function makeUrl(s) {
304304
* @param {Object} [suite]
305305
*/
306306
HTML.prototype.suiteURL = function (suite) {
307-
return makeUrl(suite.fullTitle());
307+
return makeUrl('^' + escapeRe(suite.fullTitle()) + ' ');
308308
};
309309

310310
/**
@@ -313,7 +313,7 @@ HTML.prototype.suiteURL = function (suite) {
313313
* @param {Object} [test]
314314
*/
315315
HTML.prototype.testURL = function (test) {
316-
return makeUrl(test.fullTitle());
316+
return makeUrl('^' + escapeRe(test.fullTitle()) + '$');
317317
};
318318

319319
/**

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy