karma-fixtures-preprocessor
Reads the content of your fixture files and constructs a global array, __FIXTURES__
, that contains the content of those files.
Installation
npm install karma-fixtures-preprocessor --save
Note: Karma will automatically see and include plugins whose names start with karma-*
. However, it is possible that, in your IDE or console configurations, you're running Karma as a global Node module. In that case, you'll have to install this plugin too globally, i.e npm install karma-fixtures-preprocessor -g
.
Configuration
// karma.conf.jsmodule { config}
That's all. This plugin doesn't provide any other configurable options.
How does it work?
The plugin will read the content of each of your fixture files and push its content, as-is, to a global array called __FIXTURES__
. Because the content is pushed into the array as-is, you have to make sure that whatever is in your fixture files is valid JavaScript value.
We use this plugin in our own AngularJS project at AppAdvice to construct the __FIXTURES__
array from multiple JSON files. Then in the specHelper.js
of our Jasmine tests, we do:
angular
LICENSE
MIT - Copyright (C) AppAdvice.