【发布时间】:2016-05-30 07:50:04
【问题描述】:
这是我第一次尝试使用 karma,在尝试启动测试时遇到了一些问题。
我的文件夹结构如下:
node_modules
-angular-mocks
src
-compiled
-lib
-tests
-karma.conf.js
现在,在我的 karma.conf.js 中,这是我的文件列表和基本路径:
module.exports = function (config) {
config.set({
basePath: '../../',
frameworks: ['jasmine'],
files: [
{pattern: 'lib/ionic/js/ionic.bundle.js', included: true, nocache: true, watched: true},
{pattern: 'node_modules/angular-mocks/angular-mocks.js', included: true, nocache: true, watched: true},
'compiled/js/*.js',
'compiled/css/*.css',
{pattern: 'tests/unit/unit.js', included: true, nocache: true, watched: true}
],
exclude: [],
我在另一个窗口中打开命令提示符并使用 karma start 运行 karma,所有浏览器都打开并连接,而不是如果我键入 karma run(而 karma start 仍在运行),结果如下:
18 02 2016 08:35:26.708:WARN [watcher]: Pattern "c:/src/app/src/tests/src/lib/ionic/js/ionic.bundle.js" does not match any file.
18 02 2016 08:35:26.708:WARN [watcher]: Pattern "c:/src/app/src/tests/src/angular-mocks/angula-mocks.js" does not match any file.
18 02 2016 08:35:26.708:WARN [watcher]: Pattern "c:/src/app/src/tests/src/compiled/js/*.js" does not match any file.
18 02 2016 08:35:26.708:WARN [watcher]: Pattern "c:/src/app/src/tests/src/compiled/css/*.css" does not match any file.
18 02 2016 08:35:26.708:WARN [watcher]: Pattern "c:/src/app/src/tests/src/tests/unit/unit.js" does not match any file.
我可以看到文件路径错误,但我不明白为什么......有什么帮助吗?
非常感谢
【问题讨论】:
标签: angularjs unit-testing ionic-framework karma-jasmine