karma-extractor

0.1.2 • Public • Published

karma-extractor

Extract informations (path to js, app name) from index.html to make karma.conf.js more sustainable/maintainable.

Without karma-extractor, as soon as you add a dependency to your index.html, you also need to add them to your karma.conf.js in the files argument.

A solution to avoid this issue is to add all files to your karma.conf.js but your tests don't reflect reality.

With karma-extractor, your tests have exactly the same dependencies than your real project, at any time.

Getting started

 
var extractor = require('karma-extractor');
 
// asynchronous without options
extractor.extract('index.html', function (err, infos) {
    // infos.appName
    // infos.files
});
 
var options = {
    ignore: ['/socket.io/socket.io.js', 'https://*'], // default = [], use minimatch regex
    prefixes: { // default = {}
        '/bower_components/': '../bower_components'
    }
};
 
// asynchronous without options
extractor.extract('index.html', options, function (err, infos) {
    // infos.appName
    // infos.files
});
 
// synchronous
try {
    var infos = extractor.extractSync('index.html', options);
} catch (e) {
 
}
 
 

Readme

Keywords

Package Sidebar

Install

npm i karma-extractor

Weekly Downloads

0

Version

0.1.2

License

MIT

Last publish

Collaborators

  • friedrit