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

karma-json-fixtures-preprocessor

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-json-fixtures-preprocessor

A Karma plugin to compile JSON files and make them accessible from Javascript code

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13K
increased by28.63%
Maintainers
1
Weekly downloads
 
Created
Source

karma-json-fixtures-preprocessor

Preprocessor for converting .json files into .js files and making them accessible from karma test environment

Installation

{
    "devDependencies": {
        "karma": "~0.12.1",
        "karma-json-fixtures-preprocessor": "0.0.0"
    }
}

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      './fixtures/**/*.json': ['json_fixtures']
    },

    files: [
      './fixtures/**/*.json'
    ]
  });
};

How it works

Preprocessor requires .json files and converts them into .js files by storing json data as javascript objects under __fixtures__ namespace.

the following file: ./fixtures/test.json

{
    "a": "test"
}

will be accessible in your test environment:

var fixture = window.__fixtures__['fixtures/test'];
fixture["a"] // => 'test'

Keywords

FAQs

Package last updated on 02 Jun 2014

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