Skip to content

Commit bf78a64

Browse files
committed
Remove console coloring in favor of future PR
See #2915 (comment)
1 parent 9a98e80 commit bf78a64

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

spec/unit/matrix-client.spec.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ jest.mock("../../src/webrtc/call", () => ({
5858
supportsMatrixCall: jest.fn(() => false),
5959
}));
6060

61-
enum AnsiColorCode {
62-
Red = 31,
63-
Green = 32,
64-
Yellow = 33,
65-
}
66-
// Add color to text in the terminal output
67-
function decorateStringWithAnsiColor(inputString: string, decorationColor: AnsiColorCode): string {
68-
return `\x1b[${decorationColor}m${inputString}\x1b[0m`;
69-
}
70-
7161
// Utility function to ease the transition from our QueryDict type to a string record
7262
// which we can use to stringify with URLSearchParams
7363
function convertQueryDictToStringRecord(queryDict?: QueryDict): Record<string, string> {
@@ -209,21 +199,15 @@ describe("MatrixClient", function() {
209199
const receivedRequestQueryString = new URLSearchParams(
210200
convertQueryDictToStringRecord(queryParams),
211201
).toString();
212-
const receivedRequest = decorateStringWithAnsiColor(
213-
`${method} ${prefix}${path}${receivedRequestQueryString}`,
214-
AnsiColorCode.Red,
215-
);
202+
const receivedRequestDebugString = `${method} ${prefix}${path}${receivedRequestQueryString}`;
216203
const expectedQueryString = new URLSearchParams(
217204
convertQueryDictToStringRecord(next.expectQueryParams),
218205
).toString();
219-
const expectedRequest = decorateStringWithAnsiColor(
220-
`${next.method} ${next.prefix ?? ''}${next.path}${expectedQueryString}`,
221-
AnsiColorCode.Green,
222-
);
206+
const expectedRequestDebugString = `${next.method} ${next.prefix ?? ''}${next.path}${expectedQueryString}`;
223207
// If you're seeing this then you forgot to handle at least 1 pending request.
224208
throw new Error(
225-
`A pending request was not handled: ${receivedRequest} ` +
226-
`(next request expected was ${expectedRequest})\n` +
209+
`A pending request was not handled: ${receivedRequestDebugString} ` +
210+
`(next request expected was ${expectedRequestDebugString})\n` +
227211
`Check your tests to ensure your number of expectations lines up with your number of requests ` +
228212
`made, and that those requests match your expectations.`,
229213
);

0 commit comments

Comments
 (0)