我正在从Karma切换到Chutzpah的过程中,并且让我的所有测试都执行得很好,除了在Chutzpah中解释jasmine的fixturepath时,我得到的是"Fixture and not be loaded“。Chutzpah似乎不知道如何处理url的"base“部分。
it('Get all filtered', function () {
jasmine.getFixtures().fixturesPath = "base/site/js/apps/mock-json-data/";
var response = readFixtures("all.json");
makes = JSON.parse(response);
expect(makes).toBeDefined();
});Chutzpah中有没有可以告诉它解释"base“的配置?我们可以替换它,但不想强迫所有开发人员从Karma迁移到Chutzpah,这将仅用于CI
发布于 2017-03-09 01:59:15
这不是最好的解决方案,但我们最终覆盖了readFixtures函数来替换Karma所期望的url模式中的"base“,如下所示:
var rf = readFixtures;
var readFixtures = function (path) {
jasmine.getFixtures().fixturesPath =
jasmine.getFixtures().fixturesPath.replace(
'base/site/js/apps', '../'
); // makes the path relative for Chutzpah
return rf(path);
};https://stackoverflow.com/questions/42651204
复制相似问题