Jquery 无法加载jasmine karma夹具
我对这茉莉花和业力是新的。我正在尝试执行以下测试用例。我想测试HTML元素是否存在特定的类?我已经添加了jasmine jquery的引用和其他必需的js文件Jquery 无法加载jasmine karma夹具,jquery,html,karma-jasmine,Jquery,Html,Karma Jasmine,我对这茉莉花和业力是新的。我正在尝试执行以下测试用例。我想测试HTML元素是否存在特定的类?我已经添加了jasmine jquery的引用和其他必需的js文件 beforeEach(function() { calc = new MathUtils(); jasmine.getFixtures().fixturesPath = 'base'; loadFixtures('test/test1.html'); }); describe("unit test HTML Elements", fun
beforeEach(function() {
calc = new MathUtils();
jasmine.getFixtures().fixturesPath = 'base';
loadFixtures('test/test1.html');
});
describe("unit test HTML Elements", function() {
it("just testing of html file", function() {
expect(true).toEqual(true);
});
});
这是我的目录结构。我不确定我错过了什么
这是我的karma配置文件
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
// 'node_modules/jasmine',
'node_modules/jasmine-core/lib/jasmine-core/jasmine.css',
'node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js',
'node_modules/jasmine-core/lib/jasmine-core/boot.js',
'https://code.jquery.com/jquery-3.1.1.min.js',
'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
'app/*.js',
'test/*.js',
{ pattern: 'test', watched: true, served:true, included: false }
],
我得到以下错误
Pattern "/Users/harshilkumar/WebstormProjects/testingproj/test" does not match any file.
Chrome 55.0.2883 (Mac OS X 10.9.5): Executed 0 of 1 SUCCESS (0 secs / 0 secs)
Chrome 55.0.2883 (Mac OS X 10.9.5) unit test HTML Elements just testing of sample FAILED
Error: Fixture could not be loaded: /Users/harshilkumar/WebstormProjects/testingproj/test/test1.html (status: error, message: undefined)
需要帮忙吗?
如果这是一个基本错误,我深表歉意,因为我对茉莉花和Karma的事情还不熟悉。请添加框架“Karma Jasmine jquery”请添加框架“Karma Jasmine jquery”@kufufra:你能帮我一下吗?我知道你已经提供了这个问题的解决方案。这是相同的,但略有不同。您需要将基本路径设置为,例如
c:\\path\to\your\webApp
@DarrenSweeney:您的意思是我必须在baspath字段中设置路径吗?在karma配置文件中?是的,这里:basePath:'c:\\path\to\your\webApp',
@DarrenSweeney:我将basePath更改为wpp-macbook-pro-m20131126-7:testingproj harshilkumar$pwd/Users/abc/webstorprojects/testingproj
,现在我也遇到了同样的错误(我正在使用Mac)@kufufra:你能帮我一下吗?我知道你已经提供了这个问题的解决方案。这是相同的,但略有不同。您需要将基本路径设置为,例如c:\\path\to\your\webApp
@DarrenSweeney:您的意思是我必须在baspath字段中设置路径吗?在karma配置文件中?是的,这里:basePath:'c:\\path\to\your\webApp',
@DarrenSweeney:我将basePath更改为wpp-macbook-pro-m20131126-7:testingproj harshilkumar$pwd/Users/abc/webstorprojects/testingproj
,现在我也收到了相同的错误(我正在使用Mac)