Shikha thakur
Shikha thakur

Reputation: 1289

Error: need to load appropriate loader while writing unit test case

I am writing unit test case for node code and i need to compare dummy object with the actual result .

For comparing that i wrote some dummy json data in a file and i end up getting error You may need to load appropraite loaders to handle this file type

Code:

it('comparing structures',()=>{
    var result = instance.parseResponse(input,esResponse);
    assert.deepEqual( result, expectedJSON, "Two objects can be the same in value" );
});

Json:

var expectedJSON ={
DateMetric {
    aggregate: Aggregate {
        total: 0,
        average: null,
        count: 0,
        min: null,
        max: null
    },
    startDate: Fri Apr 01 2016 05: 30: 00 GMT + 0530(India Standard Time),
    weeks: []
}}

I have no idea what this error is all about

I have karma set up and i am writing test cases using mocha and chai

Any help would be appreciated.

Upvotes: 0

Views: 42

Answers (1)

DrakaSAN
DrakaSAN

Reputation: 7853

My guess is that you have to import json-loader in webpack, which seems to be a common error seeing all the googme search results.

Upvotes: 1

Related Questions