Mocha interfaces: Uncaught ReferenceError: `describe` is not defined
Mocha interfaces: Uncaught ReferenceError: `describe` is not defined
我正在使用 Gulp 与 mocha/sinon/chai 和 jquery
的 运行 业力
我的 karma.conf.js 有:
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jquery-2.1.0', 'mocha'],
// Plugin specific config
client: {
mocha: {
reporter: 'spec',
ui: 'tdd'
}
}
安装的节点模块是
"devDependencies": {
"chai": "",
"gulp": "",
"gulp-jslint": "",
"gulp-notify": "",
"gulp-phpunit": "",
"gulp-util": "",
"karma": "",
"karma-chai": "",
"karma-chrome-launcher": "",
"karma-cli": "",
"karma-firefox-launcher": "",
"karma-ie-launcher": "",
"karma-jquery": "",
"karma-mocha": "",
"karma-opera-launcher": "",
"karma-safari-launcher": "",
"karma-sinon": "",
"mocha": "",
"sinon": "*"
}
但是当我 运行 karma 我得到这个错误
"C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.5\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" C:\path\to\my\project\node_modules\gulp\bin\gulp.js --color --gulpfile c:\path\to\my\project\Gulpfile.js karma:unit
[10:58:05] Using gulpfile c:\path\to\my\project\Gulpfile.js
[10:58:05] Starting 'karma:unit'...
[2015-10-07 10:58:05.142] [DEBUG] config - Loading config c:\path\to\my\project\karma.conf.js
07 10 2015 10:58:05.236:WARN [karma]: No captured browser, open http://localhost:9876/
07 10 2015 10:58:05.245:INFO [karma]: Karma v0.13.10 server started at http://localhost:9876/
07 10 2015 10:58:05.249:INFO [launcher]: Starting browser Chrome
07 10 2015 10:58:06.262:INFO [Chrome 45.0.2454 (Windows 7 0.0.0)]: Connected on socket 3C6LlqYiiMMpHEnaAAAA with id 29319610
Chrome 45.0.2454 (Windows 7 0.0.0) ERROR
Uncaught ReferenceError: describe is not defined
at c:/path/to/my/project/test/test.class.view.js:7
我已经尝试在全球安装 karma-mocha 和 mocha。
我尝试在 karma.conf.js
上将 karma-mocha 作为插件
我使用 'tdd' 进行 mocha 配置。应该是 'bdd'.
// Plugin specific config
client: {
mocha: {
reporter: 'spec',
ui: 'bdd'
}
}
如果设置为 'bdd' 而不是 'tdd',则 'describe' 会暴露
我正在使用 Gulp 与 mocha/sinon/chai 和 jquery
的 运行 业力我的 karma.conf.js 有:
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jquery-2.1.0', 'mocha'],
// Plugin specific config
client: {
mocha: {
reporter: 'spec',
ui: 'tdd'
}
}
安装的节点模块是
"devDependencies": {
"chai": "",
"gulp": "",
"gulp-jslint": "",
"gulp-notify": "",
"gulp-phpunit": "",
"gulp-util": "",
"karma": "",
"karma-chai": "",
"karma-chrome-launcher": "",
"karma-cli": "",
"karma-firefox-launcher": "",
"karma-ie-launcher": "",
"karma-jquery": "",
"karma-mocha": "",
"karma-opera-launcher": "",
"karma-safari-launcher": "",
"karma-sinon": "",
"mocha": "",
"sinon": "*"
}
但是当我 运行 karma 我得到这个错误
"C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.1.5\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" C:\path\to\my\project\node_modules\gulp\bin\gulp.js --color --gulpfile c:\path\to\my\project\Gulpfile.js karma:unit
[10:58:05] Using gulpfile c:\path\to\my\project\Gulpfile.js
[10:58:05] Starting 'karma:unit'...
[2015-10-07 10:58:05.142] [DEBUG] config - Loading config c:\path\to\my\project\karma.conf.js
07 10 2015 10:58:05.236:WARN [karma]: No captured browser, open http://localhost:9876/
07 10 2015 10:58:05.245:INFO [karma]: Karma v0.13.10 server started at http://localhost:9876/
07 10 2015 10:58:05.249:INFO [launcher]: Starting browser Chrome
07 10 2015 10:58:06.262:INFO [Chrome 45.0.2454 (Windows 7 0.0.0)]: Connected on socket 3C6LlqYiiMMpHEnaAAAA with id 29319610
Chrome 45.0.2454 (Windows 7 0.0.0) ERROR
Uncaught ReferenceError: describe is not defined
at c:/path/to/my/project/test/test.class.view.js:7
我已经尝试在全球安装 karma-mocha 和 mocha。 我尝试在 karma.conf.js
上将 karma-mocha 作为插件我使用 'tdd' 进行 mocha 配置。应该是 'bdd'.
// Plugin specific config
client: {
mocha: {
reporter: 'spec',
ui: 'bdd'
}
}
如果设置为 'bdd' 而不是 'tdd',则 'describe' 会暴露