UNPKG

2.28 kBMarkdownView Raw
1# karma-qunit
2
3[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/karma-runner/karma-qunit)
4 [![npm version](https://img.shields.io/npm/v/karma-qunit.svg?style=flat-square)](https://www.npmjs.com/package/karma-qunit) [![npm downloads](https://img.shields.io/npm/dm/karma-qunit.svg?style=flat-square)](https://www.npmjs.com/package/karma-qunit)
5
6[![Build Status](https://img.shields.io/travis/karma-runner/karma-qunit/master.svg?style=flat-square)](https://travis-ci.org/karma-runner/karma-qunit) [![Dependency Status](https://img.shields.io/david/karma-runner/karma-qunit.svg?style=flat-square)](https://david-dm.org/karma-runner/karma-qunit) [![devDependency Status](https://img.shields.io/david/dev/karma-runner/karma-qunit.svg?style=flat-square)](https://david-dm.org/karma-runner/karma-qunit#info=devDependencies)
7
8> Adapter for the [QUnit](http://qunitjs.com/) testing framework.
9
10## Installation
11
12The easiest way is to keep `karma-qunit` as a devDependency in your `package.json` by running
13
14```bash
15$ npm install karma-qunit --save-dev
16```
17
18## Configuration
19
20Add `qunit` in the `frameworks` array in your `karma.conf.js` file. Then, in the `plugins`
21array, add `karma-qunit`.
22The following code shows the default configuration:
23
24```js
25// karma.conf.js
26module.exports = function (config) {
27 config.set({
28 frameworks: ['qunit'],
29 plugins: ['karma-qunit'],
30 files: [
31 '*.js'
32 ]
33 })
34}
35```
36
37You can also pass options for `QUnit.config` (documented [here](https://api.qunitjs.com/QUnit.config/)) as such:
38
39```js
40/// karma.conf.js
41module.exports = function (config) {
42 config.set({
43 frameworks: ['qunit'],
44 plugins: ['karma-qunit'],
45 files: [
46 '*.js'
47 ],
48
49 // client configuration
50 client: {
51 clearContext: false,
52 qunit: {
53 showUI: true,
54 testTimeout: 5000
55 }
56 }
57 })
58}
59```
60
61Note: `showUI: true` needs the `clearContext: false` option to display correctly in non-debug mode.
62
63----
64
65For more information on Karma see the [homepage]. If you're using `karma-qunit` to test Ember.js, you might find Karma's [Ember guide](http://karma-runner.github.io/0.12/plus/emberjs.html) helpful.
66
67[homepage]: http://karma-runner.github.com