Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
2.5 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | # karma-jasmine
|
---|
| 2 |
|
---|
| 3 | [![npm version](https://img.shields.io/npm/v/karma-jasmine.svg?style=flat-square)](https://www.npmjs.com/package/karma-jasmine) [![npm downloads](https://img.shields.io/npm/dm/karma-jasmine.svg?style=flat-square)](https://www.npmjs.com/package/karma-jasmine)
|
---|
| 4 |
|
---|
| 5 | [![Build Status](https://img.shields.io/travis/karma-runner/karma-jasmine/master.svg?style=flat-square)](https://travis-ci.org/karma-runner/karma-jasmine) [![Dependency Status](https://img.shields.io/david/karma-runner/karma-jasmine.svg?style=flat-square)](https://david-dm.org/karma-runner/karma-jasmine) [![devDependency Status](https://img.shields.io/david/dev/karma-runner/karma-jasmine.svg?style=flat-square)](https://david-dm.org/karma-runner/karma-jasmine?type=dev)
|
---|
| 6 |
|
---|
| 7 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/karma-runner/karma-jasmine) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
|
---|
| 8 |
|
---|
| 9 | > Adapter for the [Jasmine](https://jasmine.github.io/) testing framework.
|
---|
| 10 |
|
---|
| 11 | ## Installation
|
---|
| 12 |
|
---|
| 13 | ```bash
|
---|
| 14 | npm install karma-jasmine --save-dev
|
---|
| 15 | ```
|
---|
| 16 |
|
---|
| 17 | ## Configuration
|
---|
| 18 |
|
---|
| 19 | ```js
|
---|
| 20 | // karma.conf.js
|
---|
| 21 | module.exports = function(config) {
|
---|
| 22 | config.set({
|
---|
| 23 | frameworks: ['jasmine'],
|
---|
| 24 |
|
---|
| 25 | files: [
|
---|
| 26 | '*.js'
|
---|
| 27 | ]
|
---|
| 28 | })
|
---|
| 29 | }
|
---|
| 30 | ```
|
---|
| 31 |
|
---|
| 32 | If you want to run only some tests matching a given pattern you can do this in the following way
|
---|
| 33 |
|
---|
| 34 | ```bash
|
---|
| 35 | $ karma start &
|
---|
| 36 | $ karma run -- --grep=<pattern>
|
---|
| 37 | ```
|
---|
| 38 |
|
---|
| 39 | or
|
---|
| 40 |
|
---|
| 41 | ```js
|
---|
| 42 | module.exports = function(config) {
|
---|
| 43 | config.set({
|
---|
| 44 | ...
|
---|
| 45 | client: {
|
---|
| 46 | args: ['--grep', '<pattern>'],
|
---|
| 47 | ...
|
---|
| 48 | }
|
---|
| 49 | })
|
---|
| 50 | }
|
---|
| 51 | ```
|
---|
| 52 |
|
---|
| 53 | If you want to pass configuration options directly to jasmine you can do this in the following way
|
---|
| 54 |
|
---|
| 55 | ```js
|
---|
| 56 | module.exports = function(config) {
|
---|
| 57 | config.set({
|
---|
| 58 | client: {
|
---|
| 59 | jasmine: {
|
---|
| 60 | random: true,
|
---|
| 61 | seed: '4321',
|
---|
| 62 | oneFailurePerSpec: true,
|
---|
| 63 | failFast: true,
|
---|
| 64 | timeoutInterval: 1000
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 | })
|
---|
| 68 | }
|
---|
| 69 | ```
|
---|
| 70 |
|
---|
| 71 | ## Debug by URL
|
---|
| 72 |
|
---|
| 73 | Failing tests print a debug URL with `?spec=`. Use it with `--no_single_run`
|
---|
| 74 | and paste it into your browser to focus on a single failing test.
|
---|
| 75 |
|
---|
| 76 | ## Sharding
|
---|
| 77 |
|
---|
| 78 | By setting `config.client.shardIndex` and `config.client.totalShards`, you can
|
---|
| 79 | run a subset of the full set of specs. Complete sharding support needs to be
|
---|
| 80 | done in the process that calls karma, and would need to support test result
|
---|
| 81 | integration across shards.
|
---|
| 82 |
|
---|
| 83 | ---
|
---|
| 84 |
|
---|
| 85 | For more information on Karma see the [homepage](https://karma-runner.github.com/).
|
---|
Note:
See
TracBrowser
for help on using the repository browser.