Socket
Socket
Sign inDemoInstall

karma-webpack-bundle

Package Overview
Dependencies
38
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    karma-webpack-bundle

A personalized bundle of karma libraries and configs


Version published
Weekly downloads
108
increased by54.29%
Maintainers
1
Install size
77.0 MB
Created
Weekly downloads
 

Readme

Source

Karma Webpack Bundle

A personalized bundle of karma libraries and configs

npm deps size vulnerabilities license


Installation

npm install karma-webpack-bundle --save-dev


benchSettings : object

Settings object for karma-benchmark. I don't see any need for benchmarks to run for 5 seconds, so I've provided settings that run the benchmark for 200ms.

Properties

NameTypeDefault
[maxTime]number0.2
[minTime]number0.2
[minSamples]number1
[delay]number0
[async]booleantrue

Example

const {benchSettings} = require('karma-webpack-bundle');

benchmark('how fast is this', () => {
    [1, 2, 3].map((x) => x * 2);
}, benchSettings);


eslintrcBench : object

An eslint config object that overrides various rules from the main config for bench files.

Example
Create a file in your bench directory called .eslintrc.cjs:

const { eslintrcBench } = require('karma-webpack-bundle');

module.exports = eslintrcBench;


eslintrc : object

An eslint config object intended to live in the root of your project.

Example
Create a file in the root of your project called .eslintrc.cjs:

const { eslintrc } = require('karma-webpack-bundle');

module.exports = eslintrc;


eslintrcTests : object

An eslint config object that overrides various rules from the main config for test files.

Example
Create a file in your tests directory called .eslintrc.cjs:

const { eslintrcTests } = require('karma-webpack-bundle');

module.exports = eslintrcTests;


formatBenchmark(benchmark, browser, config) ⇒ string

A plugin for the karma-benchmarkjs-reporter formatBenchmark option. Only current difference with the default formatter is the hz number is passed through toLocaleString to make the number more readable. This is used in karmaBenchConfig.

ParamTypeDescription
benchmarkobjectThe benchmark object.
browserobjectBrowser data.
configobjectThe config object.


karmaBenchConfig([settings]) ⇒ function

Returns a config function that can be used with karma-benchmark. Sets up karma-benchmark to run in Chrome headless with karma-benchmarkjs-reporter (with the local formatBenchmark formatter), and webpack in production mode. Looks for files in a bench directory that match **/*.bench.js.

ParamTypeDescription
[settings]objectOverrides any of the provided settings.

Example
create a file in the root of your project called karma.bench.conf.js:

const {karmaBenchConfig} = require('karma-webpack-bundle');

module.exports = karmaBenchConfig();

and add a script to package.json:

    "bench": "karma start karma.bench.conf.js"

then run it:

npm run bench


karmaConfig([testRunnerConfig], [settings]) ⇒ function

Returns a config function that can be used with karma. Sets up karma to run in Chrome headless and Firefox headless with mocha and karma-mocha-reporter.

If --single-run is provided then webpack runs in production mode, otherwise it runs in dev mode.

If running on Travis CI then karma-coverage and karma-coveralls are added to reporters

By default it Looks for test files in a tests directory that match *.test.js. For source files it looks for index.js, and *.js files in a src directory or lib directory.

ParamTypeDescription
[testRunnerConfig]ArrayA valid config for test-runner-config.
[settings]objectOverrides any of the provided settings.

Example
Create a file in the root of your project called karma.conf.js:

const { karmaConfig } = require('karma-webpack-bundle');

module.exports = karmaConfig();

and add a script or two to package.json:

    "test": "karma start --single-run",
    "test-watch": "karma start",

then run it:

npm test


wallabyConfig([testRunnerConfig], [settings]) ⇒ function

Returns a config function that can be used with wallaby. Sets the test framework to mocha, runs in Chrome headless, and sets up webpack similar to the karma config.

By default it Looks for test files in a tests directory that match *.test.js. For source files it looks for index.js, and *.js files in a src directory or lib directory.

ParamTypeDescription
[testRunnerConfig]ArrayA valid config for test-runner-config.
[settings]objectOverrides any of the provided settings.

Example
create a file in the root of your project called wallaby.conf.js:

const { wallabyConfig } = require('karma-webpack-bundle');

module.exports = wallabyConfig();

Keywords

FAQs

Last updated on 14 Jul 2022

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