How can I load HTML fixtures for Javascript unit tests in Karma with Mocha?

Im searching for a decent test runner and unit testing framework for Javascript. My candidates are Karma and Mocha. Previously I used JsTestDriver, where adding HTML fixtures was easy, but I cant find a way how to load HTML fragments and access it from Mocha tests using Karma testrunner


I have a demo that uses html fixtures with jasmine here and the demo description contains links to a screencast and github repo for running with Karma. See this link.


The final solution was Karma testrunner combined with RequireJS, which has a text plugin making the loading of HTML fixtures really easy. A working example can be seen at this Minesweeper game. It's still in development phase, but the the libraries and structuring are working.

链接地址: http://www.djcxy.com/p/72244.html

上一篇: 控制器作为服务的“窗口”

下一篇: 我怎样才能加载HTML装置在卡莫与摩卡Javascript单元测试?