0

我做了几个匹配器,一个设计为总是通过,另一个设计为总是失败。

这是我的规格文件:

/* my-spec.js */
beforeEach(function() {
    var matchers = {
        toPass: function() {
            return {
                compare: function(actual) {
                    return {
                        pass: true
                    };
                }
            };
        },
        toFail: function() {
            return {
                compare: function(actual) {
                    return {
                        pass: false
                    };
                }
            };
        }
    };

    this.addMatchers(matchers);
});

describe("A suite", function() {
    it("contains spec with an expectation", function() {
        expect('this test').toPass();
        expect('this test').toFail();
    });
});

当我运行时jasmine-node tests(我的文件在tests文件夹中),我看到:

.

Finished in 0.018 seconds
1 test, 2 assertions, 0 failures, 0 skipped

我究竟做错了什么?

4

1 回答 1

0

我使用的是旧版本的 Jasmine,但遵循新文档。

于 2014-06-22T00:22:27.283 回答