为什么angularjs期望不起作用?

马塞尔

我试图用angular.js编写最简单的javascript单元测试,但是它失败了,我也不知道为什么。

test.html

<html>
  <head>
    <script src="angular-1.2.21/angular-scenario.js" ng-autotest></script>
    <script src="test1.js"></script>
  </head>
</html>

test1.js

describe('A suite', function() {
  it('should be true', function() {
    expect(5).toBe(5);
  });
});

我将两个文件(和库)都部署在服务器上,然后调用html站点。测试运行,但始终失败

expected undefined toBe 5 but was undefined

我想念什么?

V31

根据您提供的信息,我认为您尚未包含茉莉花文件

http://searls.github.io/jasmine-all/jasmine-all-min.js

包含此代码后对您的代码进行了尝试,并且可以正常工作。

这是一个工作的小提琴

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章