karma-env

0.1.0 • Public • Published

karma-env Build Status

Karma plugin for providing configuration as window.__env, mirroring superstatic/Divshot (docs).

// karma.conf.js
module.exports = function (config) {
  config.set({
    frameworks: ['env'],
 
    files: [
      '*.js'
    ],
 
    client: {
      env: {
        KEY: 'VAL'
      }
    }
  });
};
// test.js
console.log(window.__env.KEY) // => 'VAL'

You can pass in whatever environment configuration you'd like, including process.env or require('./.env.json'). If no environment is provided, window.__env will be an empty object.

/karma-env/

    Package Sidebar

    Install

    npm i karma-env

    Weekly Downloads

    7

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • bendrucker