1
我正在開發一個AngularJS應用程序。我正在嘗試對它進行一些測試。不幸的是,我似乎無法得到它的工作。我只是在我的控制檯窗口中收到一條錯誤消息:「未捕獲的ReferenceError:env未定義」。我已經複製了代碼以運行AngularJS with Jasmine中的測試。我能看到的唯一區別是我引用了CDN。我有一個jsfiddle here,代碼如下。茉莉花環未定義
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Test Results</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine-html.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/boot.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular-mocks.js"></script>
<script type="text/javascript" src="res/js/angular-scenario.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/2.0.0/jasmine.css" />
<!-- Load the Test Files-->
<script type="text/javascript" src="e2e/tests.e2e.js"></script>
</head>
<body>
<a href="#" onclick="env.execute()">run tests</a>
</body>
</html>
我的tests.e2e.js文件的內容在小提琴中。作爲參考,代碼張貼如下:
'use strict';
describe('MyApp', function() {
describe('MyPage', function() {
it('should test', function() {
expect(true).toBe(false);
});
});
});
我做錯了什麼?