Giter VIP home page Giter VIP logo

Comments (3)

mklaber avatar mklaber commented on August 10, 2024

👍

Ugly work around is to set the base property on fixture:

  beforeEach(function() {
    fixture.base = 'test/fixtures';
    var fixtures = fixture.load('test-fixture.json');
...

Gross but it should work until this gets properly resolved.

from karma-fixture.

billtrik avatar billtrik commented on August 10, 2024

@kobrigo @mklaber Unfortunately i cannot find any programmatic way to pass config options to the plugin inside the context iframe.

The only way i can think of is a permutation of @mklaber's way.
You add the one of the following to a setup file that is included and always executed before your specs:

window.fixture = new Fixture('your_path_to_your_fixtures')
// or 
window.fixture.base = 'your_path_to_your_fixtures'

Let me know if you have any other suggestions.

from karma-fixture.

billtrik avatar billtrik commented on August 10, 2024

I published 0.2.3, where i created a .setBase() method that can be executed once in a top level before().

One other option is to create a spec setup file, and load it before your specs, similarly to the require.js config file. Inside that file you could run fixture.setBase(my/fixtures/base).

I also implemented loading fixtures by passing their full filenames, including their base path, thus overriding the fixture.base value.

I could not find a way to pass configuration from the karma.conf.js file inside the context.html runtime, other that writing a preprocessor plugin, and rewriting the html2js plugin for this purpose seems like overkill. If you find/know any other way please let me know.

from karma-fixture.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.