Karma / jasmine-marbles:测试失败消息未正确格式化

时间:2017-11-13 06:58:50

标签: jasmine mocha rxjs karma-jasmine marble

我已将 jasmine-marbles 添加到我的项目中,我收到如下错误消息:

Expected $[0].frame = 20 to equal 70.
Expected $[0].notification.kind = 'E' to equal 'N'.
Expected $[0].notification.value = undefined to equal LoadSuccess().

而不是像这样:

Expected 
    {"frame":50,"notification":{"kind":"N","value":{"payload":"[
...
to deep equal 
    {"frame":40,"notification":{"kind":"N","value":{"payload":"[
...

测试:

it('should loadData$', () => {
    const action = new LoadRequest('123');
    const completion = new LoadSuccess({});

    actions$.stream = hot('-a', { a: action });
    const response = cold('-a|', { a: {} });
    const expected = cold('---c', { c: completion });

    client.loadData = () => response;

    expect(effects.loadData$).toBeObservable(expected);
});

的package.json:

"devDependencies": {
    "jasmine-core": "^2.3.4",
    "jasmine-marbles": "^0.2.0",
    "jasmine-spec-reporter": "^3.2.0",
    "karma": "1.4.1",
    "karma-chrome-launcher": "^2.0.0",
    "karma-coverage": "^1.0.0",
    "karma-jasmine": "^1.1.0",
    "karma-mocha-reporter": "^2.2.5",
    "karma-remap-istanbul": "0.2.1",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-webpack": "2.0.2",
   ...

如何修复测试失败消息?它与一些业力记者/插件/缺少图书馆有关吗?

1 个答案:

答案 0 :(得分:2)

请参阅package.json

"jasmine": "^2.5.3",
"jasmine-core": "~2.5.2",

我不知道它是否有所作为。