karma-optimizer
Karma Plugin for RaptorJS Optimizer.
Important
RaptorJS Optimizer is the older version of lasso optimizer. Consider using lasso. There is another karma plugin for lasso that you can use.
Installation
The easiest way is to keep karma-optimizer
as a devDependency in your package.json
.
or you can simply do it by:
npm install karma-optimizer --save-dev
Configuration
Make sure you include optimizer
is the first element in the frameworks array so that optimization happens before other
frameworks add their sources in the source list.
The basic configuration for karma-optimizer is detailed below:
For Simple karma testing
// karma.conf.jsmodule {config;};
For karma testing and coverage reports
// karma.conf.jsmodule {config;
Available Options
To configure this plugin, the optimizer
key in karma-config must be set.
This key will accept all the configurations that can be passed to the raptorjs optimizer, except for these keys:
-
tempdir
specifies the location of the directory where temporarily created files should be stored. -
coverage
has the coverage configuration for the optimizer.coverage
can have the below keys
-
defaultIgnore
- By default, all non javascript files and all files innode_module
,test
andtests
folder are ignored. IfdefaultIgnore
is set to false, these files will not be ignored by default. -
ignore
- A glob pattern or an array of glob patterns specifying which files to ignore. This list will be checked along with the default ignore list ifdefaultIgnore
is true or not set. If you only want the ignore list specified here to be used, set the defaultIgnore option to false. -
files
- A glob pattern or an array of glob patterns specifying which files to include for coverage. If a file is not ignored, it is tested with this pattern(s). If this option is not set, anything that is not ignored will be reported in coverage. -
reporters
- Used to specify the reporters to be used for coverage output. All Istanbul reporters are supported. Reporters can be an object if there is only one. Otherwise, you can pass an array. Each reporter will have a type and a dir key. The report will be generated in the directory specified in the dir key (one folder for each browser)
watch
has the watch configuration for optimizer.
-
defaultIgnore
- By default, all files innode_module
folder are ignored. IfdefaultIgnore
is set to false, these files will not be ignored by default. -
ignore
- A glob pattern or an array of glob patterns specifying which files to ignore. This list will be checked along with the default ignore list ifdefaultIgnore
is true or not set. If you only want the ignore list specified here to be used, set the defaultIgnore option to false. -
files
- A glob pattern or an array of glob patterns specifying which files to include for watch. If a file is not ignored, it is tested with this pattern(s). If this option is not set, anything that is not ignored will be watched.
-
ignore
- A glob pattern or an array of glob patterns specifying which files to not optimize. -
files
- A glob pattern or an array of glob patterns specifying which files to include for optimization.