Jasmine Karma错误“在afterAll \ nUncaught ReferenceError中引发了错误:未定义容器引发”

时间:2018-09-02 20:32:20

标签: karma-jasmine karma-runner

通过业力测试运行程序运行茉莉花测试时,我总是收到错误消息,

{
    "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"
  }

我的package.json如下:

 {
  "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"
}

在我的测试中,我什至没有像Afterall或Sth这样的东西。通过茉莉花Web界面执行测试,一切正常。仅在CLI级别上,我会遇到此问题。有人有想法吗?

1 个答案:

答案 0 :(得分:1)

弄清楚了。这是因为我重命名了一个文件,该文件在karma.conf.js中是通过通配符加载的,并且明确排除了我将其文件名从一个小写字母更改为一个大写字母的文件。通过在明确排除的文件中对该名称进行调整,它可以像超级按钮一样工作