0
我想使用karma在瀏覽器中運行測試。我有我的node.js服務器配置爲在端口3000上運行。我已經在我的業力配置中反映了這一點。這裏是我的karma.config.coffee
:Karma配置未能正確加載
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
然而,當我嘗試運行業力,它聲稱它正確加載配置文件,但開始的,而不是我在config指定端口3000
端口9876
,默認值,文件:
[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"
}
}
我擁有所有正確的業力的插件,所以我不認爲是問題。