Jasmine Karma Error “An error was thrown in afterAll\nUncaught ReferenceError: container is not defined thrown”

江枫思渺然 提交于 2019-12-24 08:37:22

问题


I keep getting an error when running jasmine tests via karma test runner, which reads like this:

{
    "message": "An error was thrown in afterAll\nUncaught ReferenceError: container is not defined thrown",
    "str": "An error was thrown in afterAll\nUncaught ReferenceError: container is not defined thrown"
  }

My package.json is as follows:

 {
  "name": "3dm",
  "version": "1.0.0",
  "description": "3dm",
  "main": "src/index.html",
  "dependencies": {
    "three-obj-loader": "^1.1.3",
    "three.js": "*"
  },
  "devDependencies": {
    "jasmine-core": "^3.2.1",
    "karma-chrome-launcher": "*",
    "karma-cli": "*",
    "karma-jasmine": "^1.1.2",
    "istanbul": "^0.4.5",
    "jasmine": "^3.2.0",
    "karma": "^2.0.5",
    "karma-coverage": "^1.1.2",
    "karma-coverage-istanbul-reporter": "^2.0.3",
    "karma-htmlfile-reporter": "^0.3.6",
    "karma-istanbul-preprocessor": "*",
    "karma-jasmine-html-reporter": "^1.3.1",
    "karma-junit-reporter": "^1.2.0",
    "karma-rollup-preprocessor": "^5.1.1"
  },
  "author": "",
  "license": "ISC"
}

in my tests I don't even had anything like afterall or sth. Executing the tests via jasmine web interface everything works well. Just on CLI level I get this issue. Any ideas someone?


回答1:


Figured it out. It was because I had renamed a file that in karma.conf.js was loaded via wildcard and explicitly excluded whose filename I had changed from one lower case letter to an upper case letter. With adjustment of that name in the explicitly excluded file it works like a charm



来源:https://stackoverflow.com/questions/52140813/jasmine-karma-error-an-error-was-thrown-in-afterall-nuncaught-referenceerror-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!