Skip to content

Commit

Permalink
fix(operators): strip datetimeisostring from log output
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanGerbeth committed Nov 27, 2024
1 parent 8495596 commit d26ab18
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/operators/src/log.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('log', () => {

const actual = [];
vi.spyOn(console, 'log').mockImplementation(v => {
actual.push(stripAnsiCodes(v));
actual.push(replaceDateTimeISOString(stripAnsiCodes(v)));
return v;
});

Expand All @@ -58,7 +58,7 @@ describe('log', () => {
test('logResult', async () => {
const actual = [];
vi.spyOn(console, 'log').mockImplementation(v => {
actual.push(stripAnsiCodes(v));
actual.push(replaceDateTimeISOString(stripAnsiCodes(v)));
return v;
});

Expand All @@ -84,3 +84,10 @@ const stripAnsiCodes = str => {
''
);
};

const replaceDateTimeISOString = str => {
return str.replace(
/^[0-9]{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|(02)-(0[1-9]|[12][0-9]))T(0[0-9]|1[0-9]|2[0-3]):(0[0-9]|[1-5][0-9]):(0[0-9]|[1-5][0-9])\.[0-9]{3}Z/,
' '
);
};

0 comments on commit d26ab18

Please sign in to comment.