Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing 错误:无法加载装置:fixtures/test.html(状态:Error,消息:undefined)_Unit Testing_Jasmine_Karma Runner_Karma Jasmine_Jasmine Jquery - Fatal编程技术网

Unit testing 错误:无法加载装置:fixtures/test.html(状态:Error,消息:undefined)

Unit testing 错误:无法加载装置:fixtures/test.html(状态:Error,消息:undefined),unit-testing,jasmine,karma-runner,karma-jasmine,jasmine-jquery,Unit Testing,Jasmine,Karma Runner,Karma Jasmine,Jasmine Jquery,我试图在我的测试[jasmine]中使用loadFixtures(),但它不起作用。我使用“测试/装置”作为装置目录 我正在尝试将“html”文件作为夹具加载 我正在使用typescript 我的茉莉花单位 beforeEach(()=>{ jasmine.getFixtures().fixturesPath = 'fixtures'; loadFixtures('test.html'); }) 这些包裹是 "devDependencies": { "gulp": "^3

我试图在我的测试[jasmine]中使用loadFixtures(),但它不起作用。我使用“测试/装置”作为装置目录 我正在尝试将“html”文件作为夹具加载 我正在使用typescript

我的茉莉花单位

beforeEach(()=>{
    jasmine.getFixtures().fixturesPath = 'fixtures';
    loadFixtures('test.html');
})
这些包裹是

"devDependencies": {
"gulp": "^3.9.1",
"gulp-typescript": "^2.13.6",
"jasmine": "^2.4.1",
"jasmine-jquery": "^2.1.1",
"karma": "^1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-fixture": "^0.2.6",
"karma-html2js-preprocessor": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-jasmine-jquery": "^0.1.1",
"merge2": "^1.0.2"
} 现在来看karma配置文件

module.exports = function(config) {
config.set({

})
}

您得到的错误是什么?你看到404错误了吗?A建议尝试在你的固定路径前面加上“base/”。我明白了。我已经解决了这个问题。谢谢你重播,你的错误是什么?你看到404错误了吗?A建议尝试在你的固定路径前面加上“base/”。我明白了。我已经解决了这个问题。谢谢你重播
// 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-jquery',
    'jasmine',
    'fixture'
  ],


// list of files / patterns to load in the browser
files: [
  'bower_components/jquery/dist/jquery.js',
  './bin/test/**/*.js',
  './dest/**/*.js',
    {
      pattern: './test/fixtures/*.html',
      watched: true,
      served: true,
      included: false
    }
],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity