jasmine-marbles icon indicating copy to clipboard operation
jasmine-marbles copied to clipboard

Differences are vanished in error output message

Open bence-balogh-intland opened this issue 2 years ago • 2 comments

Hi guys, Please consider the following test case:

    it.only('should whatever', () => {
        const result$ = cold('-a--|', {
            a: { prop: NaN }
        });

        const expectedResult$ = cold('-a--|', {
            a: { prop: null }
        });

        expect(result$).toBeObservable(expectedResult$);
    });

The 2 prop obviously differs, so the test case will fail. Unfortunately, the difference is vanished from the output message, since during stringification of frames, NaN becomes null: image

The differences should be highlighted as follows: image

Could you please check?

Thanks, Bence

bence-balogh-intland avatar May 12 '23 08:05 bence-balogh-intland

Probably same issue as in: https://github.com/CodeSequence/jasmine-marbles/pull/88

bence-balogh-intland avatar May 12 '23 08:05 bence-balogh-intland

One of the few reasons jest-marbles may be used over jasmine-marbles is that due to the output of jasmine-marbles it's nearly impossible to compare complex observables.

Here a simple comparison:

jasmine-marbles (running with jest) ⬇️

jasmine marble output

jest-marbles (also running with jest) ⬇️

jest marble output

As you can see, it's way easier to detect what went wrong inside the test-case with the better formatted print, highlighting and fifing

NiklasPor avatar Jul 21 '23 08:07 NiklasPor