1

I use rxjs-marbles for testing observables in my Angular 7 app. But it looks like m.expect is not recognized by jasmine as expectation.

I have following test:

it('should see expectations', marbles(m => {
  const source: Observable<Message> = m.hot('^a--b--c');
  m.expect(source).toBeObservable('-a--b--c');
}));

When I run it I get error in console:

ERROR: 'Spec 'FeatureFlagsService should see expectations' has no expectations.'

Also in browser output my test is prefixed with:

SPEC HAS NO EXPECTATIONS should see expectations

Adding expect(true).toBe(true); fixes the issue but this is not really way I want to go.

How to register m.expect as a expectation for jasmine?

Martin Nuc
  • 5,604
  • 2
  • 42
  • 48
  • Did you import from rxjs-marbles/jasmine? [rxjs-marbles/jasmine](https://github.com/cartant/rxjs-marbles/blob/master/examples/jasmine/basic-spec.ts) – dmcgrandle Nov 10 '18 at 20:50
  • @dmcgrandle Yes, I use this import. I will try to create a stackblitz with reproduction. – Martin Nuc Nov 11 '18 at 00:20

1 Answers1

0

It was actually cased by the lib itself. I created an issue on github and it was solved quickly: https://github.com/cartant/rxjs-marbles/issues/51

Martin Nuc
  • 5,604
  • 2
  • 42
  • 48