1. karma-rollup-plugin
A Karma preprocessor plugin to offer seamless integration with Rollup
karma-rollup-plugin
Package: karma-rollup-plugin
Created by: TrySound
Last modified: Sun, 19 Jun 2022 08:04:25 GMT
Version: 0.2.4
License: MIT
Downloads: 955
Repository: https://github.com/TrySound/karma-rollup-plugin

Install

npm install karma-rollup-plugin
yarn add karma-rollup-plugin

karma-rollup-plugin Build Status

A Karma preprocessor plugin to offer seamless integration with rollup

This plugin is a Karma preprocessor to compile and bundle your spec entry point on the fly. It works seamless with all Rollup plugins.

Features

  • supports Rollup by default
  • supports both Babel and Buble as the ES2015 compiler
  • sourceMap
  • recompiling of dependencies when files changes
  • ES3, ES5, ES2015, ES2016, and ES2017 (with Babel or Buble)

Installation

The easiest way is to keep karma-rollup-plugin as a devDependency. You can simple do it by:

 npm i karma-rollup-plugin --save-dev

Configuration

Note! As a rule of thumb, use of umd format doesn't make sense in tests, and will throw a warning without a module name.

Following code shows the default configuration

 // karma.conf.js
module.exports = function (config) {
  config.set({
    preprocessors: {
     'test/**/*.js': ['rollup']
    },
    rollupPreprocessor: {
      // rollup settings. See Rollup documentation
      plugins: [
        buble() // ES2015 compiler by the same author as Rollup
      ],
      // will help to prevent conflicts between different tests entries
      format: 'iife',
      sourceMap: 'inline'
    }
  });
};

See Rollup documentation - JavaScript API for more details.

Why this plugin?

There exist a karma-rollup-preprocessor plugin for Karma, but it contains too many bugs, and doesn't seem to be maintained atm.
This plugin try to stay true to the Rollup ecosystem.

Dependencies

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin