Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 29 additions & 22 deletions src/logger/__tests__/transports/github.test.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepStrictEqual, strictEqual } from 'assert';
import { strictEqual } from 'assert';
import { describe, it } from 'node:test';

import { LogLevel } from '../../constants.mjs';
Expand All @@ -24,9 +24,10 @@ describe('github', () => {
);

strictEqual(process.stdout.write.mock.callCount(), 1);
deepStrictEqual(callsArgs, [
'::debug::[00:00:00.000] \x1B[34mDEBUG\x1B[39m: Test message\n',
]);
strictEqual(
callsArgs[0].trim(),
'::debug::[00:00:00.000] \x1B[34mDEBUG\x1B[39m: Test message'
);
});

it('should print info messages', t => {
Expand All @@ -47,9 +48,10 @@ describe('github', () => {
);

strictEqual(process.stdout.write.mock.callCount(), 1);
deepStrictEqual(callsArgs, [
'::notice ::[00:00:00.000] \x1B[32mINFO\x1B[39m: Test message\n',
]);
strictEqual(
callsArgs[0].trim(),
'::notice ::[00:00:00.000] \x1B[32mINFO\x1B[39m: Test message'
);
});

it('should print error messages ', t => {
Expand All @@ -71,9 +73,10 @@ describe('github', () => {
);

strictEqual(process.stdout.write.mock.callCount(), 1);
deepStrictEqual(callsArgs, [
'::error ::[00:00:00.000] \x1B[35mERROR\x1B[39m: Test message\n',
]);
strictEqual(
callsArgs[0].trim(),
'::error ::[00:00:00.000] \x1B[35mERROR\x1B[39m: Test message'
);
});

it('should print fatal messages', t => {
Expand All @@ -95,9 +98,10 @@ describe('github', () => {
);

strictEqual(process.stdout.write.mock.callCount(), 1);
deepStrictEqual(callsArgs, [
'::error ::[00:00:00.000] \x1B[31mFATAL\x1B[39m: Test message\n',
]);
strictEqual(
callsArgs[0].trim(),
'::error ::[00:00:00.000] \x1B[31mFATAL\x1B[39m: Test message'
);
});

it('should print messages with file', t => {
Expand Down Expand Up @@ -128,9 +132,10 @@ describe('github', () => {
);

strictEqual(process.stdout.write.mock.callCount(), 1);
deepStrictEqual(callsArgs, [
'::notice file=test.md,line=1,endLine=1::[00:00:00.000] \x1B[32mINFO\x1B[39m: Test message\n',
]);
strictEqual(
callsArgs[0].trim(),
'::notice file=test.md,line=1,endLine=1::[00:00:00.000] \x1B[32mINFO\x1B[39m: Test message'
);
});

it('should print child logger name', t => {
Expand All @@ -152,9 +157,10 @@ describe('github', () => {
);

strictEqual(process.stdout.write.mock.callCount(), 1);
deepStrictEqual(callsArgs, [
'::notice ::[00:00:00.000] \x1B[32mINFO\x1B[39m (child1): Test message\n',
]);
strictEqual(
callsArgs[0].trim(),
'::notice ::[00:00:00.000] \x1B[32mINFO\x1B[39m (child1): Test message'
);
});

it('should print without colors if FORCE_COLOR = 0', t => {
Expand All @@ -178,8 +184,9 @@ describe('github', () => {
);

strictEqual(process.stdout.write.mock.callCount(), 1);
deepStrictEqual(callsArgs, [
'::notice ::[00:00:00.000] INFO: Test message\n',
]);
strictEqual(
callsArgs[0].trim(),
'::notice ::[00:00:00.000] INFO: Test message'
);
});
});
Loading