Karma配置无法正确加载

时间:2013-12-16 17:12:55

标签: node.js karma-runner

我正在尝试使用业力在浏览器中运行测试。我将node.js服务器配置为在端口3000上运行。我已经在我的业力配置中反映了这一点。这是我的karma.config.coffee

module.exports = (config)->
    config.set
        # hostname used when capturing browsers
        hostname: 'localhost'

        # base path, used to resolve file includes and excludes
        basePath: './'

        # Watch files? No, we use Grunt for this instead
        autoWatch = false

        # frameworks to use
        frameworks: ['mocha', 'requirejs']

        # list of files / patterns to load in the browser
        files: [
            'public/**/*.js'
        ]

        # list of files to exclude
        exclude: [ ]

        # test results reporter to use
        # possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
        reporters: ['progress']

        # web server port
        port: 3000

        # enable / disable colors in the output (reporters and logs)
        colors: true

        # level of logging
        # possible values:
        #   config.LOG_DISABLE
        #   config.LOG_ERROR
        #   config.LOG_WARN
        #   config.LOG_INFO
        #   config.LOG_DEBUG
        logLevel: config.LOG_DEBUG

        # Start these browsers, currently available:
        # - Chrome
        # - ChromeCanary
        # - Firefox
        # - Opera (has to be installed with `npm install karma-opera-launcher`)
        # - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
        # - PhantomJS
        # - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
        browsers: ['Chrome', 'Firefox', 'PhantomJS']

        # If browser does not capture in given timeout [ms], kill it
        captureTimeout: 6000,

        # Continuous Integration mode
        # if true, it capture browsers, run tests and exit
        singleRun: false

然而,当我尝试运行业力时,它声称它正确加载了配置文件,但是从端口9876启动,默认值,而不是我在配置文件中指定的端口3000

[jay-mba-osx ~/redrabbit/mean-seed]% karma run karma.config.coffee
[2013-12-16 10:07:46.986] [DEBUG] config - Loading config /Volumes/MEDIA/redrabbit/mean-seed/karma.config.coffee
There is no server listening on port 9876

我觉得我做的事情非常愚蠢或忽视了一些简单的事情,但我无法弄清楚。如果它很重要,这里也是我的节点插件:

{
  "name": "stories",
  "version": "0.0.0",
  "description": "A place to design your own CYOA stories",
  "main": "server.js",
  "scripts": {
    "test": "mocha"
  },
  "author": "",
  "license": "MIT",
  "dependencies": {
    "express": "~3.4.4",
    "ez-ctrl": "0.0.5"
  },
  "devDependencies": {
    "grunt": "~0.4.2",
    "grunt-contrib-uglify": "~0.2.7",
    "grunt-contrib-coffee": "~0.7.0",
    "grunt-contrib-watch": "~0.5.3",
    "grunt-nodemon": "~0.1.2",
    "grunt-mocha-test": "~0.8.1",
    "should": "~2.1.0",
    "karma-script-launcher": "~0.1.0",
    "karma-chrome-launcher": "~0.1.1",
    "karma-firefox-launcher": "~0.1.1",
    "karma-html2js-preprocessor": "~0.1.0",
    "karma-jasmine": "~0.1.3",
    "karma-coffee-preprocessor": "~0.1.1",
    "requirejs": "~2.1.9",
    "karma-requirejs": "~0.2.0",
    "karma-phantomjs-launcher": "~0.1.1",
    "karma": "~0.10.6",
    "grunt-karma": "~0.6.2",
    "mocha": "~1.14.0",
    "karma-mocha": "~0.1.1",
    "grunt-newer": "~0.6.0",
    "grunt-contrib-less": "~0.8.3",
    "grunt-contrib-copy": "~0.4.1",
    "ejs": "~0.8.5"
  }
}

我有所有正确的业力插件,所以我不相信这是问题。

1 个答案:

答案 0 :(得分:1)

我明白了。我的配置文件中有一条坏线:

    autoWatch = false

应该是:

    autoWatch: false

既然业力正在运行,我还有更多问题......