【发布时间】:2015-08-10 15:52:50
【问题描述】:
我正在尝试在我的应用程序(Ext js 5)中实现 jasmine 以进行单元测试。为此,我创建了 app-test 文件。
Ext.require('Ext.app.Application');Ext.Loader.setConfig({enabled:true});
Ext.onReady(function() {
var Application = Ext.create('Ext.app.Application', {
name: 'epmct',
appFolder:'app',
launch: function() {
Ext.create('epmct.view.vpp.dashboard.VppDashboardMainPage');
}
});
});
当我通过 specrunner.html(文件开始单元测试)运行应用程序时,我收到错误
Uncaught Error: [Ext.Loader] Some requested files failed to load.
我尝试使用 Ext.Loader.setPath('epmct','app'); 设置路径还是不行。
请找到我的 specrunner.html 文件代码
<!DOCTYPE html><html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner v2.3.2</title>
<link rel="shortcut icon" type="image/png" href="test/jasmine/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="test/jasmine/jasmine.css">
<script type="text/javascript" src="test/jasmine/jasmine.js"></script>
<script type="text/javascript" src="test/jasmine/jasmine-html.js"></script>
<script type="text/javascript" src="test/jasmine/boot.js"></script>
<!-- include Ext Js files and Css... -->
<script src="ext/ext-all.js"></script>
<!-- include spec files here... -->
<script type="text/javascript" src="app-test.js"></script>
<script type="text/javascript" src="test/spec/DashboardSpec.js"></script>
</head>
<body>
</body>
</html>
【问题讨论】:
-
你没有使用 Sencha CMD 吗?如果是,则无需使用
Ext.Loader。另外,如果没有 Jasmine,问题是否仍然存在? -
我在使用 sencha cmd 构建时没有任何问题......如果我想使用 jasmine,我必须创建一个 html 和其他 js 文件 app-test 来运行我的测试用例。在那如果我无法构建..我想加载所有类以便我使用 ext.loader
标签: javascript extjs extjs4 jasmine extjs5