# karma-graphql-preprocessor

> A Karma plugin. Convert GraphQL files into valid queries.

Latest version **1.0.0** (published 2017-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install karma-graphql-preprocessor
pnpm add karma-graphql-preprocessor
yarn add karma-graphql-preprocessor
bun add karma-graphql-preprocessor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-11-08 |
| First published | 2017-11-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Martin Zadražil |
| Maintainers | claryaldringen |

## Links

- npm: https://www.npmjs.com/package/karma-graphql-preprocessor
- Repository: git@github.com:claryaldringen/karma-graphql-preprocessor
- npm.io page: https://npm.io/package/karma-graphql-preprocessor

## Dependencies (2)

- [graphql](https://npm.io/package/graphql.md) ^0.11.7
- [graphql-tag](https://npm.io/package/graphql-tag.md) ^2.5.0

## Recent versions

- 1.0.0 (latest) — 2017-11-08

## README

# karma-graphql-preprocessor
[![Build Status](https://travis-ci.org/karma-runner/karma-html2js-preprocessor.png?branch=master)](https://travis-ci.org/karma-runner/karma-html2js-preprocessor)
> Preprocessor for converting GraphQL files into valid GraphQL queries.

*Note:* If you are using [AngularJS](http://angularjs.org/), check out [karma-ng-html2js-preprocessor](https://github.com/karma-runner/karma-ng-html2js-preprocessor).

## Installation

The easiest way is to keep `karma-html2js-preprocessor` as a devDependency in your `package.json`.
```json
{
  "devDependencies": {
    "karma": "~1.7.0",
    "karma-graphql-preprocessor": "~1.0.0"
  }
}
```

You can simple do it by:
```bash
npm install karma-graphql-preprocessor --save-dev
```

or
```bash
yarn add karma-graphql-preprocessor --dev
```

## Configuration

```js
// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      '**/*.gql': ['graphql']
    },

    files: [
      '*.js',
      '*.gql'
    ],

  });
};
```

## How does it work ?

This preprocessor converts HTML files into JS strings and publishes them in the global `window.__html__`, so that you can use these for testing DOM operations.

For instance this `template.html`...
```html
<div>something</div>
```
... will be served as `template.html.js`:
```js
window.__html__ = window.__html__ || {};
window.__html__['template.html'] = '<div>something</div>';
```

See the [end2end test](https://github.com/karma-runner/integration-tests/blob/master/html2js/test.js) for a complete example.

----

For more information on Karma see the [homepage].


[homepage]: http://karma-runner.github.com

---
_Source: https://npm.io/package/karma-graphql-preprocessor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
