javascript - How to serve JSON files in karma -


i having great trouble karma serve json files needed in application. don't want mock json, need served on karma server.

when check in karma browser, can load html files in template folder fine. json files in data folder not found.

but have configured both folders in exact same way!

i tried add fixture plugin, has no effect on json files being served.

my karma configuration:

module.exports = function(config) {   config.set({      // base path used resolve patterns (eg. files, exclude)     basepath: './',      // frameworks use     // available frameworks: https://npmjs.org/browse/keyword/karma-adapter     frameworks: [         'jasmine-jquery',         'jasmine',         'requirejs',         'fixture'     ],       // list of files / patterns load in 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 output (reporters , logs)     colors: true,      loglevel: config.log_warn,      autowatch: true,      browsers: [         'firefox'     ],      singlerun: false,    });//config.set };//module.exports 

one of application's requirejs modules loads json files:

define([     "text!../data/mydata.json" ], function (crowdui, jsondata) {//prerequisites     'use strict';      fields = json.parse(jsondata);  }); 


Comments