Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

karma-electron

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-electron

Karma launcher and preprocessor for Electron

  • 3.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
decreased by-77.2%
Maintainers
1
Weekly downloads
 
Created
Source

karma-electron Build status Build status

Karma launcher and preprocessor for Electron

This was written to allow for directly testing in Electron where we might want require to work automatically

Features:

  • Tested via CI on Linux and Windows
  • Support for Node.js integration in the renderer process (e.g. process, require, __filename)
    • Currently submodules (e.g. require('./abc')) don't receive the same window object. See docs/submodules.md for workarounds.
  • Support for hidden browser windows
  • Support for isolated test runs to prevent cookie/localStorage pollution

Getting Started

On a project that has been set up with karma init already, install the module via:

# Install our module and `electron-prebuilt`
npm install karma-electron electron-prebuilt

Then, configure the module:

// Inside `karma.conf.js`
browsers: ['Electron']

// If you would like Node integration support (e.g. `require`)
//   then, you must include this in `preprocessors`
preprocessors: {
  '**/*.js': ['electron']
}

Then, we can run Karma:

karma start

Documentation

Environment variables

  • ELECTRON_BIN - Override path to use for electron
    • By default, we will use path given by electron-prebuilt

Example:

ELECTRON_BIN=/usr/bin/electron karma start

Configuration

We support configuration via Karma's custom launcher inheritance:

Example:

module.exports = function (config) {
  config.set({
    // Specify usage of our custom launcher
    browsers: ['CustomElectron'],

    // Define a custom launcher which inherits from `Electron`
    customLaunchers: {
      CustomElectron: {
        base: 'Electron',
        userDataDir: __dirname + '/.electron',
        flags: ['--show']
      }
    }
};

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via npm run lint and test via npm test.

Donating

Support this project and others by twolfson via gratipay.

Support via Gratipay

Unlicense

As of Mar 03 2016, Todd Wolfson has released this repository and its contents to the public domain.

It has been released under the UNLICENSE.

Keywords

FAQs

Package last updated on 13 May 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc