diff --git a/react-ui/src/utils/index.ts b/react-ui/src/utils/index.ts index a5bfc774..e2121282 100644 --- a/react-ui/src/utils/index.ts +++ b/react-ui/src/utils/index.ts @@ -501,10 +501,10 @@ export function toDecimals(num: number, decimals: number) { * 解析 k8s 日志 * * @param log - k8s 日志 - * @param isLine - 是否按行解析,默认按行解析 + * @param isLine - 是否按行解析 * @returns 解析后的日志 */ -export function parseK8sLog(log: string, isLine: boolean = true) { +export function parseK8sLog(log: string, isLine: boolean) { // 判断是否存在时间戳与stdout F/stderr P 前缀,如果有则去掉,并且末尾添加换行符 if (isLine) { const reg = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+\+\d{2}:\d{2} (stdout|stderr) [F|P] /; diff --git a/react-ui/tests/parseK8sLog.test.ts b/react-ui/tests/parseK8sLog.test.ts index 27dce4f7..acd8c854 100644 --- a/react-ui/tests/parseK8sLog.test.ts +++ b/react-ui/tests/parseK8sLog.test.ts @@ -37,11 +37,4 @@ describe('test parseK8sLog()', () => { expect(result).toBe(log); }); }); - - // 测试默认参数 - test('should use isLine = true by default', () => { - const log = '2023-01-01T00:00:00.000+00:00 stdout F test log'; - const result = parseK8sLog(log); - expect(result).toBe('test log\n'); - }); });