1
當試圖在瀏覽器中使用Mocha(version 1.3.2),沿the given example線,我想在the expected way到指定可接受的全局,當出現以下情況例外(即類似mocha.globals(['amplify', '_'])
):mocha.globals是「不確定」
Uncaught TypeError: Object function Mocha(options) {
options = options || {};
this.files = [];
this.options = options;
this.grep(options.grep);
this.suite = new exports.Suite('', new exports.Context);
this.ui(options.ui);
this.reporter(options.reporter);
if (options.timeout) this.suite.timeout(options.timeout);
} has no method 'globals'
這在Chrome 21.0.1180中展出。
可以通過轉到given example link並在瀏覽器控制檯中運行mocha.globals(['123'])
來重現此操作。
我期望mocha.globals
工作正如鏈接的例子所示,或者有一些關於替代文件的文檔,但我沒有找到。
跟進,在JS解決辦法是:mocha.setup({UI: 'BDD',全局:[ '玉']}) – 2012-11-09 17:23:53