refresh review pipeline
This commit is contained in:
+12
-16
@@ -4,6 +4,8 @@ import { section, step, line, input, output, result, ok, warn, error } from '../
|
||||
|
||||
afterEach(() => mock.restoreAll());
|
||||
|
||||
const TS = '\\[\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}:\\d{2}\\]';
|
||||
|
||||
describe('log helpers', () => {
|
||||
it('formats section and step messages', () => {
|
||||
const calls = [];
|
||||
@@ -14,10 +16,8 @@ describe('log helpers', () => {
|
||||
section('Pipeline');
|
||||
step('Step1', 'Start');
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
'\n=== Pipeline ===',
|
||||
'\n[Step1] Start',
|
||||
]);
|
||||
assert.match(calls[0], new RegExp(`^\\n${TS}\\[INF\\]: === Pipeline ===$`));
|
||||
assert.match(calls[1], new RegExp(`^\\n${TS}\\[INF\\]: \\[Step1\\] Start$`));
|
||||
});
|
||||
|
||||
it('formats line and ok messages with console.log', () => {
|
||||
@@ -29,10 +29,8 @@ describe('log helpers', () => {
|
||||
line('hello');
|
||||
ok('done');
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
' - hello',
|
||||
' ✓ done',
|
||||
]);
|
||||
assert.match(calls[0], new RegExp(`^${TS}\\[INF\\]: - hello$`));
|
||||
assert.match(calls[1], new RegExp(`^${TS}\\[INF\\]: ✓ done$`));
|
||||
});
|
||||
|
||||
it('formats input/output and pass/fail result messages', () => {
|
||||
@@ -46,12 +44,10 @@ describe('log helpers', () => {
|
||||
result(true, '通過');
|
||||
result(false, '未通過');
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
' ← 輸入:5 筆',
|
||||
' → 輸出:3 筆',
|
||||
' ✅ 成功:通過',
|
||||
' ❌ 失敗:未通過',
|
||||
]);
|
||||
assert.match(calls[0], new RegExp(`^${TS}\\[INF\\]: ← 輸入:5 筆$`));
|
||||
assert.match(calls[1], new RegExp(`^${TS}\\[INF\\]: → 輸出:3 筆$`));
|
||||
assert.match(calls[2], new RegExp(`^${TS}\\[INF\\]: ✅ 成功:通過$`));
|
||||
assert.match(calls[3], new RegExp(`^${TS}\\[ERR\\]: ❌ 失敗:未通過$`));
|
||||
});
|
||||
|
||||
it('formats warn messages with console.warn', () => {
|
||||
@@ -62,7 +58,7 @@ describe('log helpers', () => {
|
||||
|
||||
warn('careful');
|
||||
|
||||
assert.deepEqual(calls, [' ! careful']);
|
||||
assert.match(calls[0], new RegExp(`^${TS}\\[WRN\\]: ! careful$`));
|
||||
});
|
||||
|
||||
it('formats error messages with console.error', () => {
|
||||
@@ -73,6 +69,6 @@ describe('log helpers', () => {
|
||||
|
||||
error('boom');
|
||||
|
||||
assert.deepEqual(calls, [' x boom']);
|
||||
assert.match(calls[0], new RegExp(`^${TS}\\[ERR\\]: x boom$`));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user