Javascript 如何在karma中提供JSON文件

Javascript 如何在karma中提供JSON文件,javascript,json,karma-runner,karma-jasmine,Javascript,Json,Karma Runner,Karma Jasmine,我很难让Karma为我的应用程序中需要的json文件提供服务。我不想模仿json,我只需要在karma服务器上提供它 当我签入Karma浏览器时,我可以将HTML文件加载到模板文件夹中。 但是找不到数据文件夹中的JSON文件 但是我用完全相同的方式配置了这两个文件夹 我尝试添加fixture插件,但它对提供的JSON文件没有任何影响 我的业力配置: module.exports = function(config) { config.set({ // base path that

我很难让Karma为我的应用程序中需要的json文件提供服务。我不想模仿json,我只需要在karma服务器上提供它

当我签入Karma浏览器时,我可以将HTML文件加载到模板文件夹中。 但是找不到数据文件夹中的JSON文件

但是我用完全相同的方式配置了这两个文件夹

我尝试添加fixture插件,但它对提供的JSON文件没有任何影响

我的业力配置:

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

    // 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',
        'requirejs',
        'fixture'
    ],


    // list of files / patterns to load in the browser
    files: [
        //frontend
        {pattern: 'frontend/js/*.js', watched: true, served: true, included: false},
        {pattern: 'frontend/templates/*.*', watched: true, served: true, included: false},
        {pattern: 'frontend/data/*.json', watched: true, served: true, included: false},

        {pattern: 'test/**/*Spec.js', watched: true, included: false},

        //'test/helpers/jasmine-jquery.js',
        'test/helpers/jasmine-ajax-helper.js',
        'test/test-main.js'
    ],

    proxies: {
        "/templates/": "/base/frontend/templates/",
        "/base/../templates/": "/base/frontend/templates/",
        "/data/": "/base/frontend/data/",
        "/base/../data/": "/base/frontend/data/"
    },

    preprocessors: {
        '**/*.json'       : ['json_fixtures']
    },

    jsonFixturesPreprocessor: {
        variableName: '__json__'
    },

    // web server port
    port: 9876,

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

    logLevel: config.LOG_WARN,

    autoWatch: true,

    browsers: [
        'Firefox'
    ],

    singleRun: false,

  });//config.set
};//module.exports
我的应用程序的一个requireJS模块加载JSON文件:

define([
    "text!../data/mydata.json"
], function (crowdUI, jsonDATA) {//prerequisites
    'use strict';

    fields = JSON.parse(jsonDATA);

});

我也在努力解决这个问题。。。你找到解决办法了吗?有什么消息吗?