question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error output for completed observable

See original GitHub issue

Given code snipped produces unreadable (as expected) error output

const { merge } = require('rxjs/operators')
const { cold, hot } = require('jest-marbles');

describe("RxJS", () => {
    it('Should merge two hot observables and start emitting from the subscription point', () => {
        const e1 = hot('----a--^--b-------c--|', {a: 0});
        const e2 = hot('  ---d-^--e---------f-----|', {a: 0});
        const expected = cold('--d-(be)----c-f-----|', {a: 0});
        //                       ^--- added this so assertion fails

        expect(e1.pipe(merge(e2))).toBeObservable(expected);
    });
})

jest-marbles: 2.3.0 rxjs: 6.4.0 Output:

  ● RxJS › Should merge two hot observables and start emitting from the subscription point

    expect(received).toBeNotifications(expected)

    Expected notifications to be:
      [{"frame": 20, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 40, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 40, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 120, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 140, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 200, "notification": {"error": undefined, "hasValue": false, "kind": "C", "value": undefined}}]
    But got:
      [{"frame": 30, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 30, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 110, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 130, "notification": {"error": undefined, "hasValue": true, "kind": "N", "value": undefined}}, {"frame": 190, "notification": {"error": undefined, "hasValue": false, "kind": "C", "value": undefined}}]

    Difference:

    - Expected
    + Received

      Array [
        Object {
    -     "frame": 20,
    +     "frame": 30,
          "notification": Notification {
            "error": undefined,
            "hasValue": true,
            "kind": "N",
            "value": undefined,
          },
        },
        Object {
    -     "frame": 40,
    +     "frame": 30,
          "notification": Notification {
            "error": undefined,
            "hasValue": true,
            "kind": "N",
            "value": undefined,
          },
        },
        Object {
    -     "frame": 40,
    +     "frame": 110,
          "notification": Notification {
            "error": undefined,
            "hasValue": true,
            "kind": "N",
            "value": undefined,
          },
        },
        Object {
    -     "frame": 120,
    +     "frame": 130,
          "notification": Notification {
            "error": undefined,
            "hasValue": true,
            "kind": "N",
            "value": undefined,
          },
        },
        Object {
    -     "frame": 140,
    +     "frame": 190,
          "notification": Notification {
            "error": undefined,
    -       "hasValue": true,
    -       "kind": "N",
    -       "value": undefined,
    -     },
    -   },
    -   Object {
    -     "frame": 200,
    -     "notification": Notification {
    -       "error": undefined,
            "hasValue": false,
            "kind": "C",
            "value": undefined,
          },
        },
      ]

      at TestScheduler.assertDeepEqual (node_modules/jest-marbles/umd/webpack:/JestMarbles/src/rxjs/assert-deep-equal.ts:29:20)
      at Object.<anonymous> (node_modules/jest-marbles/umd/webpack:/JestMarbles/index.ts:67:19)

Looks like a root cause of the issue is in this line https://github.com/meltedspark/jest-marbles/blob/29360098dea0ea95d7b714c75d1be0d5de8a4b15/src/jest/custom-matchers.ts#L13 Completion notification produces undefined value which fails check in containNonCharacterValue function.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
just-jebcommented, Mar 29, 2019

Interesting, I’ll take look.

1reaction
just-jebcommented, Mar 12, 2019

Fixed in 2.3.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

RxJs Error Handling: Complete Practical Guide
As usual and like with any RxJs Operator, catchError is simply a function that takes in an input Observable, and outputs an Output...
Read more >
How to throw an observable error manually? - Stack Overflow
For instance there is the timeoutWith() operator, which is perhaps one of the most likely reasons you'll need to do this. results$ =...
Read more >
Error output for completed observable · Issue #101 - GitHub
Completion notification produces undefined value which fails check in containNonCharacterValue function. The text was updated successfully, but ...
Read more >
Error & Completion of Observable | Observables | Angular 12+
In the last lecture we learned that an observable is a way of handling asynchronous data. It emits data. Apart from data, an...
Read more >
Error Handling With Observable Sequences | RxJS
The first topic is catching errors as they happen with our streams. In the Reactive Extensions, any error is propogated through the onError...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found