Giter VIP home page Giter VIP logo

Comments (6)

billtrik avatar billtrik commented on August 10, 2024 1

I verified the problem, but it is not due to the plugin's implementation.
It is due to your config file.

For future reference, i will be extra detailed here.
Let's imagine a folder structure like this:

test
->fixtures
->->json_fixture1.json
->->json
->->->json_fixture2.json

so we have 2 json files:

  • test/fixtures/json_fixture1.json
  • test/fixtures/json/json_fixture1.json

by adding this in your config:

files: [
  {
    pattern: 'test/fixtures/**',
  },
],

you load both files.

So far so good.

But on your preprocessor config you say:

preprocessors: {
  ...
  'test/fixtures/*.json': ['json_fixtures']
  ...
},

Please note the *.json part.
By doing this you tell the "json_fixtures" preprocessor to only parse the files that exist inside the "test/fixtures" folder
and NOT any other files that might exist in any of its subdirectories.

So the json_fixture1.json will be parsed and loaded properly,
but the json_fixture2.json will not and it will produce the mentioned error.

If you alter your preprocessor config like this:

preprocessors: {
  ...
  // notice the '**/*.json' vs '*.json'
  'test/fixtures/**/*.json': ['json_fixtures']
  ...
},

It will parse and load properly all the json files found inside the "test/fixtures" dir,
thus solving the problem.

from karma-fixture.

pietrovismara avatar pietrovismara commented on August 10, 2024

+1 ?

from karma-fixture.

datatypevoid avatar datatypevoid commented on August 10, 2024

Any update on this issue?

from karma-fixture.

pietrovismara avatar pietrovismara commented on August 10, 2024

@datatypevoid Nope, i just stopped usign karma-fixture, due to no support, and not working package.

from karma-fixture.

chennighan avatar chennighan commented on August 10, 2024

@pietrovismara I've similarly tried with no luck. Horrible support for this package. Have you found another karma based solution for loading external json data?

from karma-fixture.

billtrik avatar billtrik commented on August 10, 2024

I am linking this on the README since it seems to be a popular problem. I am also marking this as closed.
@pietrovismara @datatypevoid @chennighan
If someone still has issues 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.