Error loading JSON fixture from a path above the base path

57 views
Skip to first unread message

Ashar Ghani

unread,
Jul 17, 2017, 5:10:32 PM7/17/17
to Jasmine
I have a setup that requires me to load a JSON fixture from a path that is above the base path. I am using jasmine-jquery to load the JSON fixture as follows:

jasmine.getJSONFixtures().fixturesPath = 'base/../';
var fixture = getJSONFixture('filename.json');
 
but it doesn't succeed.

I have also tried:

jasmine.getJSONFixtures().fixturesPath = 'base';
var fixture = getJSONFixture('../filename.json');

but this gives the same result.

What's the correct way to do this?

Thanks,
Ashar 

Gregg Van Hove

unread,
Jul 22, 2017, 12:38:20 PM7/22/17
to jasmi...@googlegroups.com
If you're using a library that uses a server to load your suite, as opposed to just a `.html` file on the filesystem, you'll need to configure it to be able to serve any files that the browser will need access to. This may mean changing your base directory, and the glob paths under it to get the same files while allowing you to load file outside of your src and spec dirs.

Hope this helps. Thanks for using Jasmine!

-Gregg

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+unsubscribe@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at https://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages