npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

karma-lasso

v5.0.0

Published

karma plugin for lasso

Downloads

95

Readme

Build Status Code Climate Documentation

Dependency Status devDependency Status peerDependency Status

karma-lasso

Karma Plugin for Lasso.js.

Installation

The easiest way is to keep karma-lasso as a devDependency in your package.json.


{
    "devDependencies": {
        "karma": "~0.10",
        "karma-lasso": "^0.0"
    }
}

or you can simply do it by:


npm install karma-lasso --save-dev

Configuration

Make sure you include lasso 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-lasso is detailed below:

For Simple karma testing


// karma.conf.js
module.exports = function (config) {
    config.set({
        browsers: [
            'PhantomJS'
        ],
        reporters: [
            'mocha'
        ],
        // 1. specify the config to be passed to lasso in the lasso key
        lasso: {
            plugins: [
                'lasso-less',
                'lasso-marko',
            ],
            minify: false,
            bundlingEnabled: false,
            resolveCssUrls: true,
            cacheProfile: 'development',
            // 2. tempdir is the directory where all the generated files will be stored.
            tempdir: './.test'
        },
        // 3. lasso should be added as a framework so that it can do bundling before tests
        frameworks: [
            'lasso',
            'mocha',
            'chai'
        ],
        // 4. Only specify the main test file that requires the source files. karma-lasso
        // will expand it and add all required files
        files: [
            './test/client/**/*.js'
        ],
        // 5. Add karma-lasso as a plugin
        plugins: [
            // .. other plugins
            'karma-lasso'
        ]
    });
};

For karma testing and coverage reports


// karma.conf.js
module.exports = function (config) {
    config.set({
        browsers: [
            'PhantomJS'
        ],
        // 1. for generating coverage reports, add lasso as a reporter in config
        reporters: [
            'mocha',
            'lasso'
        ],
        // 2. specify the config to be passed to lasso in the lasso key
        lasso: {
            plugins: [
                'lasso-less',
                'lasso-marko',
            ],
            minify: false,
            bundlingEnabled: false,
            resolveCssUrls: true,
            cacheProfile: 'development',     
            // 3. tempdir is the directory where all the generated files will be stored.
            tempdir: './.coverage',
            // 4. to enable coverage, the coverage key should be added in the lasso config
            coverage: {
                // 5. A string glob pattern or an array of patterns matching the files for which,
                // coverage report is to be generated 
                files: 'src/**/*.js',
                // 6. 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) 
                reporters: [
                    {
                        type: 'json',
                        dir: './.coverage/json/'
                    },
                    {
                        type: 'html',
                        dir: './.coverage/html-client/'
                    }
                ]
            }
        }
    });

Available Options

To configure this plugin, the lasso key in karma-config must be set.

This key will accept all the configurations that can be passed to the raptorjs lasso, except for these keys:

  1. tempdir specifies the location of the directory where temporarily created files should be stored.

  2. coverage has the coverage configuration for the lasso. coverage can have the below keys

  • defaultIgnore - By default, all non javascript files and all files in node_module, test and tests folder are ignored. If defaultIgnore 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 if defaultIgnore 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)

  1. watch has the watch configuration for lasso.
  • defaultIgnore - By default, all files in node_module folder are ignored. If defaultIgnore 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 if defaultIgnore 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.

  1. ignore - A glob pattern or an array of glob patterns specifying which files to not optimize.

  2. files - A glob pattern or an array of glob patterns specifying which files to include for optimization.

  3. moduleSearchPath - if you are using the app-module-path module, Set this key to a single path (string) or multiple paths (array). Note: This module will not resolve the app-module-path dependency. If you are using this param, make sure app-module-path is added as a dependency in your module.