🌜
🌞
karma-jasmine

karma-jasmine

v5.1.0

A Karma plugin - adapter for Jasmine testing framework.

npm install karma-jasmine

README

karma-jasmine

npm version npm downloads Release Workflow Status js-standard-style semantic-release

Adapter for the Jasmine testing framework.

Installation

npm install karma-jasmine --save-dev

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    frameworks: ['jasmine'],
    files: [
      '*.js'
    ]
  })
}

If you want to run only some tests whose name match a given pattern you can do this in the following way

$ karma start &
$ karma run -- --grep=<pattern>

where pattern is either a string (e.g --grep=#slow runs tests containing "#slow") or a Regex (e.g --grep=/^(?!.*#slow).*$/ runs tests not containing "#slow").

You can also pass it to karma.config.js:

module.exports = function(config) {
  config.set({
    // ...
    client: {
      args: ['--grep', '<pattern>'],
      // ...
    }
  })
}

If you want to pass configuration options directly to jasmine you can do this in the following way

module.exports = function(config) {
  config.set({
    client: {
      jasmine: {
        random: true,
        seed: '4321',
        oneFailurePerSpec: true,
        failFast: true,
        timeoutInterval: 1000
      }
    }
  })
}

Debug by URL

Failing tests print a debug URL with ?spec=. Use it with --no_single_run and paste it into your browser to focus on a single failing test.

Sharding

By setting config.client.shardIndex and config.client.totalShards, you can run a subset of the full set of specs. Complete sharding support needs to be done in the process that calls karma, and would need to support test result integration across shards.

Custom spec filter

Providing a custom spec filter is also supported.

Example:

// Users are able to set a custom specFilter themselves

jasmine.getEnv().configure({
  specFilter: function (spec) {
    return spec.getFullName() === 'spec that succeeds'
  }
})

describe('spec', () => {
  it('that fails', () => {
    fail('This spec should not run!')
  })

  it('that succeeds', () => {
    expect(1).toBe(1)
  })
})

For more information on Karma see the homepage.

Release Notes

5.1.0
By Karma Bot • Published on June 16, 2022

5.1.0 (2022-06-16)

Features

  • spec-filter: allow custom specFilter (b73dbd6)
5.0.1
By Karma Bot • Published on May 13, 2022

5.0.1 (2022-05-13)

Bug Fixes

  • fixes matches performance issue, github#302 (e964fa6)
5.0.0
By Karma Bot • Published on April 12, 2022

5.0.0 (2022-04-12)

Bug Fixes

  • limit karma peer dependency to ^6.0.0 (d72c124)

Build System

  • drop Node.js 10 support (ea691e8)

Features

  • deps: update dependencies including jasmine-core (821f094)

BREAKING CHANGES

  • The minimum required version of karma is 6.0.0.
  • The minimum required version of Node is 12.0.0.
  • deps: jasmine-core was updated to the 4.1.0.

Please refer to the release notes for the complete list of changes and migration instructions.

4.0.2
By Karma Bot • Published on March 30, 2022

4.0.2 (2022-03-30)

Bug Fixes

  • sync package-lock.json and package.json (4dacc5d)
4.0.1
By Karma Bot • Published on August 12, 2020

4.0.1 (2020-08-12)

Bug Fixes

  • adapter: filter functions from result.order (#272) (28f337c)
4.0.0
By Karma Bot • Published on August 11, 2020

4.0.0 (2020-08-11)

chore

BREAKING CHANGES

  • Drop support for node 8 (add support for node 14)
3.3.1
By Karma Bot • Published on May 28, 2020

3.3.1 (2020-05-28)

Bug Fixes

3.3.0
By Karma Bot • Published on May 28, 2020

3.3.0 (2020-05-28)

Features

  • reporter: emit info events for suiteStarted/suiteDone (#269) (7b73ce0)
3.2.0
By Karma Bot • Published on May 26, 2020

3.2.0 (2020-05-26)

Features

  • results: forward passedExpectations and properties (#268) (ad1d7dd)
3.1.1
By Karma Bot • Published on February 11, 2020

3.1.1 (2020-02-11)

Bug Fixes

  • adapter: do not emit debug url unless in a browser (#263) (9bcce88), closes #262

General

License
MIT
Typescript Types
Tree-shakeable
No

Popularity

GitHub Stargazers
535
Community Interest
789
Number of Forks
164

Maintenance

Commits
10/219/22025
Last Commit
Jun 16, 2022
Open Issues
21
Closed Issues
131
Open Pull Requests
8
Closed Pull Requests
67

Versions

Versions Released
10/219/2201
Latest Version Released
Current Tags
latest5.1.0
2_00.2.2

Contributors

vojtajina
vojtajina
Commits: 58
johnjbarton
johnjbarton
Commits: 36
zzo
zzo
Commits: 18
dignifiedquire
dignifiedquire
Commits: 14
maksimr
maksimr
Commits: 13
olegskl
olegskl
Commits: 11
semantic-release-bot
semantic-release-bot
Commits: 7
readme42
readme42
Commits: 5
XhmikosR
XhmikosR
Commits: 5
r-park
r-park
Commits: 4
tehvgg
tehvgg
Commits: 3
fadc80
fadc80
Commits: 2
toolmagic
toolmagic
Commits: 1
nicojs
nicojs
Commits: 1
sahat
sahat
Commits: 1