Skip to content

Commit b050d60

Browse files
honsq90Evgeny Barabanov
authored andcommitted
feat(output): use native JSON.stringify pretty print option
1 parent 2a29e92 commit b050d60

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/jest/custom-matchers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Marblizer } from '../marblizer';
22
import diff from 'jest-diff';
3-
import equal from 'fast-deep-equal';
43
import { printExpected, printReceived, matcherHint } from 'jest-matcher-utils';
54
import { TestMessage } from 'rxjs/testing/TestMessage';
65
import { SubscriptionLog } from 'rxjs/testing/SubscriptionLog';
@@ -14,18 +13,19 @@ function haveValueObjects(actual: TestMessage[], expected: TestMessage[]) {
1413

1514
export const customTestMatchers = {
1615
toBeNotifications(actual: TestMessage[], expected: TestMessage[]) {
17-
let actualMarble: string | TestMessage[];
18-
let expectedMarble: string | TestMessage[];
16+
let actualMarble: string;
17+
let expectedMarble: string;
1918

2019
if (haveValueObjects(actual, expected)) {
21-
actualMarble = actual;
22-
expectedMarble = expected;
20+
const spaces = 2;
21+
actualMarble = JSON.stringify(actual, null, spaces);
22+
expectedMarble = JSON.stringify(expected, null, spaces);
2323
} else {
2424
actualMarble = Marblizer.marblize(actual);
2525
expectedMarble = Marblizer.marblize(expected);
2626
}
2727

28-
const pass = equal(actualMarble, expectedMarble);
28+
const pass = actualMarble === expectedMarble;
2929

3030
const message = pass
3131
? () =>

0 commit comments

Comments
 (0)