Karma-mocha在测试期间挂起

时间:2015-04-23 12:12:11

标签: unit-testing mocha karma-runner

我最近决定开始学习如何编写测试。我正在使用角度所以我决定使用业力和摩卡来运行测试。我在这里遵循了这个教程:http://attackofzach.com/setting-up-a-project-using-karma-with-mocha-and-chai/

然而它对我不起作用。我每次运行测试时都会得到这个结果:

INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Linux)]: Connected on socket RRl1GLX7HZj_VG8_KSSz with id 13178195

它没有超越这一点。我认为这可能是愚蠢的,因为要测试的代码是一个空文件。但是看到文件存在,我认为它会返回错误。

这是我的Karma.conf.js文件:

describe("A test suite", function() {
beforeEach(function() { });
afterEach(function() { });
it('should fail', function() { expect(true).to.be.false; });
});

这是我的package.json:

{
"name": "testingNew",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "BSD-2-Clause",
"devDependencies": {
"karma": "~0.12.31",
"mocha": "~2.2.4",
"karma-mocha": "~0.1.10",
"chai": "~2.2.0",
"karma-chai": "~0.1.0",
"sinon": "~1.14.1",
"karma-sinon": "~1.0.4",
"karma-phantomjs-launcher": "~0.1.4"
}
}

如果有人之前遇到过这个问题,或者对如何修复它有任何想法,那将非常感激。与往常一样,如果您需要查看更多代码或获取问题的更多信息,请询问。提前谢谢。

0 个答案:

没有答案