diff --git a/test/utils.test.ts b/test/utils.test.ts index becb8fd626..8fdb47a842 100644 --- a/test/utils.test.ts +++ b/test/utils.test.ts @@ -197,13 +197,13 @@ describe('Utils', () => { const warningSpy = vi.spyOn(console, 'warn'); const errorSpy = vi.spyOn(console, 'error'); logger.debug('debug', 'zh'); - expect(debugSpy).toHaveBeenCalledWith('zh: debug'); + expect(debugSpy).toHaveBeenCalledWith(expect.stringMatching(/^\[\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d\d\dZ\] zh: debug$/)); logger.info('info', 'zh'); - expect(infoSpy).toHaveBeenCalledWith('zh: info'); + expect(infoSpy).toHaveBeenCalledWith(expect.stringMatching(/^\[\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d\d\dZ\] zh: info$/)); logger.warning('warning', 'zh'); - expect(warningSpy).toHaveBeenCalledWith('zh: warning'); + expect(warningSpy).toHaveBeenCalledWith(expect.stringMatching(/^\[\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d\d\dZ\] zh: warning$/)); logger.error('error', 'zh'); - expect(errorSpy).toHaveBeenCalledWith('zh: error'); + expect(errorSpy).toHaveBeenCalledWith(expect.stringMatching(/^\[\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d\d\dZ\] zh: error$/)); setLogger(mockLogger); expect(logger).toEqual(mockLogger);