Socket
Socket
Sign inDemoInstall

karma-filesort

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    karma-filesort

Sort files before a Karma run.


Version published
Weekly downloads
4
Maintainers
1
Install size
2.81 kB
Created
Weekly downloads
 

Readme

Source

karma-filesort

Sorts and modifies Karma files lists using JS functions. No more tricky RegExps!

This plugin has been inspired by karma-angular-filesort, on which it is heavily based.

Installation

npm install --save-dev karma-filesort

Compatibility

This plugin is compatible with Karma version 0.13.x and above.

Configuration

A full plugin configuration would look something like this:

// karma.conf.js
module.exports = function(config) {
  config.set({
    //Include 'filesort' as a framework
    frameworks: ['jasmine', 'filesort'],
    
    files: [
      'bower_components/angular/angular.js',
      'bower_components/angular-mocks/angular-mocks.js',
      'app/**/*.js',
      'test/**/*.js'
    ],

    fileSort: {
        //Sort or modify included files (ones that are included on the page with the <script> tag.
        included: function (includedFiles, log) {
            return includedFiles.filter(function (file) {
                //Filter the list of files using any JS code.
                return ~file.path.indexOf('exclude');
            })
        },
        //Sort or modify served files (ones that are not included on the page, but can be requested manually).
        //If you use it, make sure that served files contain all the included files.
        served: function (servedFiles, log) {
            //Log them, sort them, do anything you want.
            servedFiles.forEach(file=>log.info(file.path));
            //Just return the modified array.
            return servedFiles;
        },
    }
  });
};

License

MIT

Keywords

FAQs

Last updated on 01 Aug 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc