我正在尝试为我的Angular应用程序运行Jasmine单元测试,但由于某种原因它告诉我模块没有定义。我已经搜索了解决方案,许多解决方案都没有引用 angular-mocks.js 。 我添加了angular-mocks.js,它仍然告诉我它没有定义。
我的SpecRunner:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jasmine Spec Runner v2.0.3</title>
<link rel="shortcut icon" type="image/png" href="lib/jasmine-2.0.3/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="lib/jasmine-2.0.3/jasmine.css">
<script type="text/javascript" src="lib/jasmine-2.0.3/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.3/jasmine-html.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.3/boot.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.3/mokeAjax.js"></script>
<!-- include source files here... -->
<script src="../../public/lib/angular/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-mocks.js"></script>
<script src="../../public/javascripts/app.js"></script>
<script src="../../public/javascripts/controllers/calendarController.js"></script>
<script src="../public/javascripts/services/afsprakenService.js"></script>
<!-- include spec files here... -->
<script type="text/javascript" src="./spec/StockSpec.js"></script>
</head>
<body id="pagina">
</body>
</html>
我的StockSpec.js:
describe('myApp', function () {
beforeEach(function () {
module('myApp');
})
it ('test', function () {
expect(myApp).toBeDefined()
})
})
我在这里做错了什么?我很确定我的路径是正确的;
编辑:它已经解决了。我检索角度模拟的URL不包含版本号(facepalm)。