Jasmine无法找到Spec文件

在我的MEAN项目目录中,我试图在我的快速控制器上运行Jasmine单元测试.我最初运行node-jasmine但是为了增加功能,我将改为Jasmine 2.4.但是我遇到了jasmine.json的位置问题,当我尝试解决方法时,我遇到了jasmine源代码中的错误.

我的jasmine.json目前读取:

{
    "spec_dir": "spec",
    "spec_files": "**/*[sS]pec.js"
}

我的文件结构是:http://imgur.com/WHg0u8M

我的jasmine.json在支持范围内,我的模型单元测试在server / controllers / notesSpec.js中.如果我尝试改变这个:

jasmine JASMINE_CONFIG_PATH=test/spec/support/jasmine.json

我已经尝试过控制台记录源代码,其中一些你可以在下面看到.但是,我仍然收到以下错误:

config file path is: /Users/matthewbridges/Projects/markpad/spec/support/jasmine.json
config file is: [object Object]
the spec directory is: undefined
files are: **/*[sS]pec.js
/usr/local/lib/node_modules/jasmine/lib/jasmine.js:116
  files.forEach(function(specFile) {
    ^

TypeError: files.forEach is not a function

将jasmine.json拉入默认文件路径仍然会出现相同的错误.

我还将添加package.json的潜在相关位

脚本:
    “test-jasmine”:“jasmine test / server / controllers / notesSpec.js”

dev-dependencies: 
  "devDependencies": {
    "autoprefixer-core": "^5.2.1",
    "frisby": "^0.8.5",
    "grunt": "^0.4.5",
    "grunt-angular-templates": "^0.5.7",
    "grunt-concurrent": "^1.0.0",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-concat": "^0.5.0",
    "grunt-contrib-connect": "^0.9.0",
    "grunt-contrib-copy": "^0.7.0",
    "grunt-contrib-jshint": "^0.11.0",
    "grunt-contrib-sass": "^1.0.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-express": "^1.4.1",
    "grunt-filerev": "^2.1.2",
    "grunt-google-cdn": "^0.4.3",
    "grunt-jscs": "^1.8.0",
    "grunt-karma": "^0.12.2",
    "grunt-mongo-bin": "^0.1.0",
    "grunt-newer": "^1.1.0",
    "grunt-ng-annotate": "^0.9.2",
    "grunt-parallel": "^0.4.1",
    "grunt-postcss": "^0.5.5",
    "grunt-protractor-runner": "^3.1.0",
    "grunt-protractor-webdriver": "^0.2.5",
    "grunt-svgmin": "^2.0.0",
    "grunt-usemin": "^3.0.0",
    "grunt-wiredep": "^2.0.0",
    "jasmine": "^2.4.1",
    "jit-grunt": "^0.9.1",
    "jshint-stylish": "^1.0.0",
    "karma": "^0.13.22",
    "karma-jasmine": "^0.3.8",
    "karma-phantomjs-launcher": "^1.0.0",
    "method-override": "^2.3.5",
    "mocha": "^2.4.5",
    "mongoose": "^4.4.9",
    "node-mocks-http": "^1.5.2",
    "phantomjs-prebuilt": "^2.1.6",
    "prettyjson": "^1.1.3",
    "protractor": "^3.2.1",
    "should": "^8.2.2",
    "time-grunt": "^1.0.0",
    "webdriver-manager": "^8.0.0"
  }

我会发布任何其他相关信息,
谢谢.

最佳答案 你的jasmine.json无效;它应该看起来像这样:

{
    "spec_dir": "spec",
    "spec_files": [
        "**/*[sS]pec.js"
    ]
}
点赞