Skip to content

Commit 3fd0072

Browse files
authored
fix(win): os agnostic tests (#464)
1 parent 9b9c751 commit 3fd0072

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

src/logger/__tests__/transports/github.test.mjs

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { deepStrictEqual, strictEqual } from 'assert';
1+
import { strictEqual } from 'assert';
22
import { describe, it } from 'node:test';
33

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

2626
strictEqual(process.stdout.write.mock.callCount(), 1);
27-
deepStrictEqual(callsArgs, [
28-
'::debug::[00:00:00.000] \x1B[34mDEBUG\x1B[39m: Test message\n',
29-
]);
27+
strictEqual(
28+
callsArgs[0].trim(),
29+
'::debug::[00:00:00.000] \x1B[34mDEBUG\x1B[39m: Test message'
30+
);
3031
});
3132

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

4950
strictEqual(process.stdout.write.mock.callCount(), 1);
50-
deepStrictEqual(callsArgs, [
51-
'::notice ::[00:00:00.000] \x1B[32mINFO\x1B[39m: Test message\n',
52-
]);
51+
strictEqual(
52+
callsArgs[0].trim(),
53+
'::notice ::[00:00:00.000] \x1B[32mINFO\x1B[39m: Test message'
54+
);
5355
});
5456

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

7375
strictEqual(process.stdout.write.mock.callCount(), 1);
74-
deepStrictEqual(callsArgs, [
75-
'::error ::[00:00:00.000] \x1B[35mERROR\x1B[39m: Test message\n',
76-
]);
76+
strictEqual(
77+
callsArgs[0].trim(),
78+
'::error ::[00:00:00.000] \x1B[35mERROR\x1B[39m: Test message'
79+
);
7780
});
7881

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

97100
strictEqual(process.stdout.write.mock.callCount(), 1);
98-
deepStrictEqual(callsArgs, [
99-
'::error ::[00:00:00.000] \x1B[31mFATAL\x1B[39m: Test message\n',
100-
]);
101+
strictEqual(
102+
callsArgs[0].trim(),
103+
'::error ::[00:00:00.000] \x1B[31mFATAL\x1B[39m: Test message'
104+
);
101105
});
102106

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

130134
strictEqual(process.stdout.write.mock.callCount(), 1);
131-
deepStrictEqual(callsArgs, [
132-
'::notice file=test.md,line=1,endLine=1::[00:00:00.000] \x1B[32mINFO\x1B[39m: Test message\n',
133-
]);
135+
strictEqual(
136+
callsArgs[0].trim(),
137+
'::notice file=test.md,line=1,endLine=1::[00:00:00.000] \x1B[32mINFO\x1B[39m: Test message'
138+
);
134139
});
135140

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

154159
strictEqual(process.stdout.write.mock.callCount(), 1);
155-
deepStrictEqual(callsArgs, [
156-
'::notice ::[00:00:00.000] \x1B[32mINFO\x1B[39m (child1): Test message\n',
157-
]);
160+
strictEqual(
161+
callsArgs[0].trim(),
162+
'::notice ::[00:00:00.000] \x1B[32mINFO\x1B[39m (child1): Test message'
163+
);
158164
});
159165

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

180186
strictEqual(process.stdout.write.mock.callCount(), 1);
181-
deepStrictEqual(callsArgs, [
182-
'::notice ::[00:00:00.000] INFO: Test message\n',
183-
]);
187+
strictEqual(
188+
callsArgs[0].trim(),
189+
'::notice ::[00:00:00.000] INFO: Test message'
190+
);
184191
});
185192
});

0 commit comments

Comments
 (0)