0.1.0 • Published 10 years ago

karma-env v0.1.0

Weekly downloads
19
License
MIT
Repository
github
Last release
10 years ago

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.