将 Ionic 与 jasmine-karma 一起使用,在运行测试时,编译成功,但在 jasmine 仪表板中出现空屏幕,控制台中出现错误。
以下教程:https://leifwells.github.io/2017/08/27/testing-in-ionic-configure-existing-projects-for-testing/ https://leifwells.github.io/2017/08/27/testing-in-ionic-configure-existing-projects-for-testing/
"ts-loader": "^4.1.0",
"jasmine-core": "^2.99.1"
错误消息:
TypeError: env.stopOnSpecFailure is not a function at adapter.js:26
Error: Module build failed: TypeError: Cannot read property 'afterCompile' of undefined
失败发生在您尝试使用 stopOnSpecFailure 函数的 karma-jasmine 版本中。您的 jasmine-core 版本中不存在该功能,您需要版本 3 或更高版本。 3.1.0 版本是目前最新的并且运行良好。另请注意,如果您使用的是 Webpack 3,您还应该将 ts-loader 降级到 3.5.0 https://github.com/TypeStrong/ts-loader/blob/master/CHANGELOG.md.
UPDATE:
我注意到很多人建议将 jasmine-core 降级到 2.99.1。显然人们在使用 jasmine-core 3 时遇到问题。如果你是这种情况,那么你可以使用karma-jasmine-html-reporter https://www.npmjs.com/package/karma-jasmine-html-reporter?activeTab=readme版本 0.2.2 以及 jasmine-core 2.99.1。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)