流星测试教程失败

meteor-testing tutorial fails

我启动了 meteor-testing tutorial,但是第二个自动生成的测试失败了:

TypeError: Cannot call method 'url' of undefined

所以好像没有定义客户端变量。有人遇到过类似的问题吗? (顺便说一句,有没有办法调试这个)

我正在使用 ubuntu 14.04 和

Meteor 1.2.0.2
node v4.0.0
xolvio:cucumber       0.19.4_1  CucumberJS for Velocity

更新:

生成测试代码intests/cucumber/features/step_definitions/sample_steps.js:

// You can include npm dependencies for support files in  tests/cucumber/package.json
var _ = require('underscore');

module.exports = function () {
  // You can use normal require here, cucumber is NOT run in a Meteor context (by design)
  var url = require('url');
  // 1st TEST OK
  this.Given(/^I am a new user$/, function () {
    server.call('reset'); // server is a connection to the mirror
  });
  // 2nd TEST FAIL
  this.When(/^I navigate to "([^"]*)"$/, function (relativePath) {
    // process.env.ROOT_URL always points to the mirror
    client.url(url.resolve(process.env.ROOT_URL, relativePath));
  });
...
};

有人说我提交了一份 issue in the chimp repository,其中指出了解决方案:

// 2nd TEST FAIL
this.When(/^I navigate to "([^"]*)"$/, function (relativePath) {
  // REPLACE client with browser
  browser.url(url.resolve(process.env.ROOT_URL, relativePath));
});

这是一个简短的修复,但我不确定您以后是否应该使用客户端(似乎是针对不同环境的包装器)。


**更新:** 同时这已修复,不再需要调整