Collect all your spies to observable values in one util. SpyUtil helps you keep track on each call without all that boilerplate code
For extended excamples, see main.spec.ts
const key = 'someKey';
const spyUtil: SpyUtil = new SpyUtil();
// before each
spyUtil.spySubscribe(service.someObservable, key);
spyUtil.spyException(service.someObservable, 'someOtherId');
....
// tests
expect(spyUtil.get(key)).toHaveBeenCalledTimes(1) ...
expect(spyUtil.get('someOtherId')).not.toHaveBeenCalled() ...
expect(spyUtil.allCounts()).toEqual([1, 0]) ...
expect(spyUtil.argsFor(key, 0).toEqual('some string')) ...
expect(spyUtil.lastOf(key).toEqual('some string')) ...
...
// after each
spyUtil.unsubscribe() ...
$> npm i && npm test
Your project should have rxjs,and jasmine installed - these are omitted in the bundle to avoid version conflicts
karma singleRun=false not working