docs: 補齊 JSDoc 與指令檔註解、測試移至 app/test 並重建 README #10
@@ -208,6 +208,23 @@ describe('commitAndPush', () => {
|
|||||||
assert.ok(logs.some(line => line.includes('Step8 commit 成功但 push 失敗')));
|
assert.ok(logs.some(line => line.includes('Step8 commit 成功但 push 失敗')));
|
||||||
assert.ok(logs.some(line => line.includes('pre-receive hook declined')));
|
assert.ok(logs.some(line => line.includes('pre-receive hook declined')));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not throw and does not mistake a failed push for success (commit still ran, push attempted)', async () => {
|
||||||
|
// commit 成功、僅 push 失敗:函式必須吞掉錯誤不中斷上層流程。
|
||||||
|
const spawn = makeSpawn({
|
||||||
|
push: () => ({ status: 1, stdout: '', stderr: 'fatal: unable to access remote', error: null }),
|
||||||
|
});
|
||||||
|
|
||||||
|
await assert.doesNotReject(
|
||||||
|
() => commitAndPush(workspace, path.join(workspace, 'repo'), spawn, sourceRoot),
|
||||||
|
'push failure must not crash the pipeline',
|
||||||
|
);
|
||||||
|
|
||||||
|
const commitCall = spawn.calls.find(c => c.args[0] === 'commit');
|
||||||
|
assert.ok(commitCall, 'commit should still run before the failed push');
|
||||||
|
const pushCall = spawn.calls.find(c => c.args[0] === 'push');
|
||||||
|
assert.ok(pushCall, 'push should have been attempted');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('cloneRepo', () => {
|
describe('cloneRepo', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user