Comments (3)
👍
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.
@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.
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)
- 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"
- 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
- Got unexpected token ":" when loading valid json file HOT 6
- 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
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.