velesin / jasmine-jquery

jQuery matchers and fixture loader for Jasmine framework
MIT License
1.89k stars 347 forks source link

parse error for json fixture #260

Closed shavo007 closed 9 years ago

shavo007 commented 9 years ago

Hi,

I have installed the latest using bower. "jasmine-jquery": "~2.1.0"

Then I added file entry into my karma.conf

'test/apiMocks/*.json'

i created a simple json file test.json.

Then in my jasmine tests, I have the below config:

 jasmine.getJSONFixtures().fixturesPath='base/test/apiMocks';
    var data = getJSONFixture('test.json');
    console.log('Test json is ' + JSON.stringify(data));

I keep getting parse error, even tho it is valid json.

Json output is:

{
  "property1":"value1"
}

SyntaxError: Parse error at C:/java-projects/track-ui/test/apiMocks/test.json:2

Any clue?

shavo007 commented 9 years ago

Resolved.

i changed the entry in karma.conf.js to

 {pattern: 'test/apiMocks/*.json', watched: true, served: true, included: false}

and it worked!

Closing.