跟着 这篇文章配置的 单元测试
想问一下 karma.conf.js 有没有配置路由的功能呢? 或者应该怎样配置?
02 11 2015 16:25:54.111:WARN [web-server]: 404: /test/app-weixin.test.js
Chrome 44.0.2403 (Mac OS X 10.10.5) ERROR: 'Potentially unhandled rejection [4] Error: XHR error (404 Not Found) loading http://localhost:9876/test/app-weixin.test.js
at error (http://localhost:9876/base/jspm_packages/system.src.js?48b16c48fbe11fd0d5394a09d07cfba9a9b44cce:1028:16)
at XMLHttpRequest.xhr.onreadystatechange (http://localhost:9876/base/jspm_packages/system.src.js?48b16c48fbe11fd0d5394a09d07cfba9a9b44cce:1036:13)'
因为我的项目目录有点奇葩,如下
主目录
chat //项目里的一个文件夹
jspm_packages
node_modules
test
aa.test.js
bb.test.js
source
aa.js
bb.js
karma.conf.js
package.json
README.md
karma.conf.js
module.exports = function(config) {
config.set({
basePath: '',
frameworks: [
'chai-as-promised',
'sinon-chai',
'mocha',
'jspm'
],
jspm: {
loadFiles: [
'test/**/*.js'
],
serveFiles: [
'source/**/*.js'
]
},
reports: [
'mocha'
],
exclude: [
],
preprocessors: {
},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
concurrency: Infinity
})
}
解决了问题 设置jspm中的paths