How to load external Json file using karma+Jasmine for angularJS testing?/

前端 未结 3 969
终归单人心
终归单人心 2020-12-17 22:38

Can anyone provide me an example in PLUNKER that how to load JSON file for karma/jasmine test.I want to read the data from JSON file for the test cases i am writing.I have b

3条回答
  •  温柔的废话
    2020-12-17 23:20

    You can load an external json data file using require

    var data = require('./data.json');
    console.log(data);
    // Your test cases goes here and you can use data object

提交回复
热议问题