为了让我的摩卡测试知道我的课程正在测试中(用于在浏览器中运行Mocha),有什么约定?由于两者都包裹在闭合,也不是在全球范围内...使用Mocha在浏览器中测试CS类?
monkey.spec.coffee
describe "Monkey", ->
it "adds two to the given number", ->
expect Monkey.add2(4).to.equal(6)
monkey.coffee
class Monkey
test_runner.html
<!DOCTYPE html>
<html>
<head>
<title>Mocha Test Runner</title>
<meta charset="utf8">
<link rel="stylesheet" href="mocha.css">
<script src="mocha.js"></script>
<script src="expect.js"></script>
<script>
mocha.setup('bdd');
</script>
<!-- Load in files under test -->
<script src="monkey.js"></script>
<!-- Load in spec files -->
<script src="monkey.spec.js"></script>
</head>
<body>
<div id="mocha"></div>
<script>
mocha.run();
</script>
</body>
</html>
[CoffeeScript中定义的类未在Jasmine规范中找到]的可能重复(http://stackoverflow.com/questions/8310329/classes-defined-in-coffeescript-not-found-by-jasmine-specs) –