Karma没有开始幻影

时间:2015-05-20 17:07:51

标签: angularjs node.js phantomjs gulp karma-runner

我在这里失去了理智。我有一个看起来像这样的gulp任务。

// Call this method somewhere in your view controller setup code.
- (void)registerForKeyboardNotifications
{
    [[NSNotificationCenter defaultCenter] addObserver:self
            selector:@selector(keyboardWasShown:)
            name:UIKeyboardDidShowNotification object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
             selector:@selector(keyboardWillBeHidden:)
             name:UIKeyboardWillHideNotification object:nil];

}

// Called when the UIKeyboardDidShowNotification is sent.
- (void)keyboardWasShown:(NSNotification*)aNotification {
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] 
    CGRectValue].size;
    CGRect bkgndRect = activeField.superview.frame;
    bkgndRect.size.height += kbSize.height;
    [activeField.superview setFrame:bkgndRect];
    [scrollView setContentOffset:CGPointMake(0.0, 
      activeField.frame.origin.y
      -kbSize.height
      +self.lblHeader.frame.size.height) animated:YES];
}

// Called when the UIKeyboardWillHideNotification is sent
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
    UIEdgeInsets contentInsets = UIEdgeInsetsZero;
    scrollView.contentInset = contentInsets;
    scrollView.scrollIndicatorInsets = contentInsets;
}

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    activeField = textField;
}

- (void)textFieldDidEndEditing:(UITextField *)textField
{
    activeField = nil;
}

我的karma.conf.js看起来像这样:

var gulp = require("gulp");
var karma = require("karma").server;

gulp.task("test", function (done) {
    karma.start({
        configFile: __dirname + "/karma.conf.js",
        action:"run"
    }, function () {
        done();
    });
});

然而,当我运行 module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine'], files: [ "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js", "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-resource.min.js", "https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.13.0/ui-bootstrap-tpls.min.js", "https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.14/angular-ui-router.min.js", "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-mocks.js", "src/js/**/*.js", "test/**/*.js" ], browser: ["PhantomJS"], singleRun: true }); }; 时,我得到的是:enter image description here

没有浏览器启动。测试不会运行。在此时查看其他示例时,它应该启动Phantomjs ..我在配置文件中指定了PhantomJs作为浏览器。它也没有帮助改变浏览器..如何获得启动浏览器的业力?

我不确定这是否是我失踪的超级基本步骤。谷歌搜索时我找不到任何相关内容。 任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

The documentations

  

自行捕获浏览器可能是一项繁琐且耗时的任务,因此Karma可以为您自动执行此操作。只需将要捕获的浏览器添加到配置文件中:

browsers: ['Chrome']

请注意属性的名称:它是browsers,而不是browser