Comments (6)
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.
+1 ?
from karma-fixture.
Any update on this issue?
from karma-fixture.
@datatypevoid Nope, i just stopped usign karma-fixture, due to no support, and not working package.
from karma-fixture.
@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.
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)
- json fixtures not found HOT 3
- Modifying loaded fixture data permanently modifies fixture data HOT 2
- Problem loading Karma-fixture using Jasmine HOT 2
- Same fixture object returned on multiple loads HOT 1
- Warning: No provider for "framework:fixture"! HOT 2
- Cannot find HTML fixtures. Cannot see an __html__ object HOT 2
- Multiple HTML fixtures with Jasmine / Babel, last loaded fixture overwrites all other loaded fixtures HOT 1
- Evaluate JS specified through 'src' attribute for <script> tag HOT 2
- Cannot find fixture error, unknown what to do to counter act this. HOT 16
- fixture.setBase() on global karma-shim.js HOT 4
- npm install fails on windows 7
- Auto-cleanup
- Cannot find fixture 'fixtures/div-foo.html' - fixture.load failing in beforeEach() with × "before each" hook for ... HOT 3
- Create new fixture container on cleanup
- fixture.clear() is really fixture.cleanup() HOT 1
- Throw error when fixture not found? HOT 3
- Modify base path? HOT 1
- Does not load json objects with escaped characters HOT 6
- Don't eval() text in <script> if type isn't "text/javascript" or "application/javascript"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-fixture.