test(diagnostics): 補上診斷限長與 PII 遮罩測試
This commit is contained in:
@@ -44,6 +44,25 @@ test('agentFailureDetail 在 debug 模式輸出遮罩後片段', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('agentFailureDetail 先限長再遮罩並處理常見 PII', () => {
|
||||
const oldDebug = process.env.ACTIONS_STEP_DEBUG;
|
||||
process.env.ACTIONS_STEP_DEBUG = 'true';
|
||||
try {
|
||||
const detail = diagnostics.agentFailureDetail({
|
||||
ok: false,
|
||||
error: Object.assign(new Error('boom'), { code: 3 }),
|
||||
stderr: `${'x'.repeat(520)} token=should-not-be-scanned`,
|
||||
output: 'user@example.test eyJaaaaaaaaaa.bbbbbbbbbb.cccccccccc',
|
||||
});
|
||||
assert.match(detail, /exit 3/);
|
||||
assert.doesNotMatch(detail, /should-not-be-scanned|user@example.test|eyJaaaaaaaaaa/);
|
||||
assert.match(detail, /stdout:\*\*\* \*\*\*/);
|
||||
} finally {
|
||||
if (oldDebug === undefined) delete process.env.ACTIONS_STEP_DEBUG;
|
||||
else process.env.ACTIONS_STEP_DEBUG = oldDebug;
|
||||
}
|
||||
});
|
||||
|
||||
test('postOthersToIssue 依序送出 issue 留言以維持排序', async () => {
|
||||
const calls = [];
|
||||
let active = 0;
|
||||
|
||||
Reference in New Issue
Block a user