Skip to content

Commit 9b5467f

Browse files
committed
1
1 parent 07edd6f commit 9b5467f

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/public/pages/scripts/test/github_issue.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @returns {{ owner: string, repo: string, number: string } | null} 解析结果
99
*/
1010
export function parseGithubIssueUrl(url) {
11-
const match = String(url).match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$/)
11+
const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)$/)
1212
if (!match) return null
1313
return { owner: match[1], repo: match[2], number: match[3] }
1414
}

src/public/pages/scripts/test/test_watch.mjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,22 @@ function refreshGithubIssueProbes() {
117117
githubIssueInflight.clear()
118118
}
119119

120+
/**
121+
* 规范化 `fount.test.hubUrl`(去尾斜杠;未设则为空串)。
122+
* @returns {string} hub 基址
123+
*/
124+
function getHubUrl() {
125+
return String(globalThis.fount?.test?.hubUrl || '').replace(/\/$/, '')
126+
}
127+
120128
/**
121129
* issue 是否已关闭(成功结果缓存;进行中请求复用;失败退避;无 hub / 超时 → false)。
122130
* @param {string} url 已解析的 issue URL
123131
* @param {{ refresh?: boolean }} [options] `refresh` 为 true 时跳过缓存并重新探测
124132
* @returns {Promise<boolean>} 已关闭为 true
125133
*/
126134
async function probeGithubIssueClosed(url, { refresh = false } = {}) {
127-
const hub = String(globalThis.fount?.test?.hubUrl || '').replace(/\/$/, '')
135+
const hub = getHubUrl()
128136
if (!hub) return false
129137

130138
if (refresh) {
@@ -318,7 +326,7 @@ async function runLocaleScriptCheck(locale) {
318326
* @returns {Promise<void>} 完成校验
319327
*/
320328
async function checkAriaIgnores({ refresh = false, entries = collectAriaIgnoreEntries() } = {}) {
321-
const hub = String(globalThis.fount?.test?.hubUrl || '').replace(/\/$/, '')
329+
const hub = getHubUrl()
322330
/** @type {{ url: string, location: string }[]} */
323331
const toProbe = []
324332
for (const { url, location, parsed } of entries) {

0 commit comments

Comments
 (0)