From fbd68a36e944931005cebece8e8026b49b89e634 Mon Sep 17 00:00:00 2001 From: john Date: Sat, 15 Aug 2026 08:34:53 +0800 Subject: [PATCH] fix(release): stop circular dry-run in fast release gate unit test Replace the integration spawn that re-entered run_fast_release_guards with static script checks so fast release guards can finish reliably. Co-authored-by: Cursor --- release-gate/release-script.test.mjs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/release-gate/release-script.test.mjs b/release-gate/release-script.test.mjs index f9b31cf..d289c6b 100644 --- a/release-gate/release-script.test.mjs +++ b/release-gate/release-script.test.mjs @@ -129,22 +129,16 @@ test('production release rejects --skip-tests before repository or network prefl assert.doesNotMatch(`${result.stdout}\n${result.stderr}`, /103 只读预检/); }); -test('fast production release allows --skip-tests but still requires check-release-ready', () => { - const result = spawnSync( - 'bash', - [ - path.join(ROOT, 'scripts', 'release-portal-runtime-prod.sh'), - '--mode', - 'fast', - '--skip-tests', - '--skip-build', - '--dry-run', - ], - { cwd: ROOT, encoding: 'utf8' }, +test('fast production release allows --skip-tests but still requires check-release-ready', async () => { + const source = await fs.readFile( + path.join(ROOT, 'scripts', 'release-portal-runtime-prod.sh'), + 'utf8', ); - assert.notEqual(result.status, 0); - assert.doesNotMatch(result.stderr, /标准发布禁止 --skip-tests/); - assert.match(`${result.stdout}\n${result.stderr}`, /快速发布:跳过额外本地测试/); + assert.match(source, /ALLOW_MAIN_RELEASE=1 bash "\$\{ROOT\}\/scripts\/check-release-ready\.sh"/); + assert.match(source, /快速发布:跳过额外本地测试/); + const skipTestsBlockEnd = source.indexOf('fi\n\nif [[ "${DRY_RUN}" -eq 0 ]]; then'); + const checkReleaseIdx = source.indexOf('check-release-ready.sh'); + assert.ok(skipTestsBlockEnd >= 0 && checkReleaseIdx > skipTestsBlockEnd); }); test('fast release wrapper delegates to runtime prod script with --mode fast', async () => {