# karma-jest

> A Karma framework for using some of Jest's best features in a browser.

Latest version **1.0.0-beta.0** (published 2020-03-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install karma-jest
pnpm add karma-jest
yarn add karma-jest
bun add karma-jest
```

## 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-beta.0 |
| Published | 2020-03-10 |
| First published | 2020-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 20 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | yes |
| Author | 4Catalyzer |
| Maintainers | monastic.panic |

## Links

- npm: https://www.npmjs.com/package/karma-jest
- Repository: https://github.com/4Catalyzer/karma-jest
- Homepage: https://github.com/4Catalyzer/karma-jest#readme
- Issues: https://github.com/4Catalyzer/karma-jest/issues
- npm.io page: https://npm.io/package/karma-jest

## Dependencies (20)

- [expect](https://npm.io/package/expect.md) ^25.1.0
- [marked](https://npm.io/package/marked.md) ^0.8.0
- [jest-mock](https://npm.io/package/jest-mock.md) ^25.1.0
- [source-map](https://npm.io/package/source-map.md) ^0.7.3
- [@jest/types](https://npm.io/package/@jest/types.md) ^25.1.0
- [ansi-colors](https://npm.io/package/ansi-colors.md) ^4.1.1
- [jest-circus](https://npm.io/package/jest-circus.md) ^25.1.0
- [@4c/cli-core](https://npm.io/package/@4c/cli-core.md) ^2.1.1
- [@types/mocha](https://npm.io/package/@types/mocha.md) ^7.0.1
- [@jest/console](https://npm.io/package/@jest/console.md) ^25.1.0
- [@types/marked](https://npm.io/package/@types/marked.md) ^0.7.2
- [jest-snapshot](https://npm.io/package/jest-snapshot.md) 25.1.0
- [@jest/reporters](https://npm.io/package/@jest/reporters.md) ^25.1.0
- [@babel/code-frame](https://npm.io/package/@babel/code-frame.md) ^7.8.3
- [@jest/fake-timers](https://npm.io/package/@jest/fake-timers.md) ^25.1.0
- [@jest/test-result](https://npm.io/package/@jest/test-result.md) ^25.1.0
- [jest-message-util](https://npm.io/package/jest-message-util.md) ^25.1.0
- [error-stack-parser](https://npm.io/package/error-stack-parser.md) ^2.0.6
- [@rollup/plugin-alias](https://npm.io/package/@rollup/plugin-alias.md) ^3.0.1
- [@types/babel__code-frame](https://npm.io/package/@types/babel__code-frame.md) ^7.0.1

## Recent versions

- 1.0.0-beta.0 (latest) — 2020-03-10
- 1.0.0-beta.18 (next) — 2020-10-23
- 1.0.0-beta.17 — 2020-10-07
- 1.0.0-beta.16 — 2020-10-07
- 1.0.0-beta.15 — 2020-08-28
- 1.0.0-beta.14 — 2020-08-28
- 1.0.0-beta.13 — 2020-08-28
- 1.0.0-beta.12 — 2020-08-20
- 1.0.0-beta.11 — 2020-08-07
- 1.0.0-beta.10 — 2020-08-07
- 1.0.0-beta.9 — 2020-08-07
- 1.0.0-beta.8 — 2020-05-11
- 1.0.0-beta.7 — 2020-05-08
- 1.0.0-beta.6 — 2020-05-08
- 1.0.0-beta.5 — 2020-05-08
- … 4 more at https://npm.io/package/karma-jest/versions

## README

## karma-jest

A Karma framework for using some of Jest's best features in a browser.

## Install

```sh
npm i karma-jest -D
```

Or with yarn

```sh
yarn add karma-jest -D
```

## Usage

In your karma config:

```js
module.exports = config => {
  config.set({
    // add your test files
    files: ['test/**/*.test.js'],

    plugins: ['karma-jest'],
    frameworks: ['jest'],
    reporters: ['jest'],

    // Add options
    jest: {
      snapshotPath: 'test/__snapshots__',
    },
  });
};
```

### Options

At the momement there is only one option:

- `snapshotPath`: the directory snapshots are saved in, defaults to: `path.join(karmaConfig.basePath, '__snapshots__')`

### Differences from Jest

Because a browser is very different environment from Node, there are a few
key differences with how `karma-jest` works compared to Jest.

- Compiling and bundling test files is up to you. Use which ever karam preprocessor
  is appropriate for your project, probably `karma-webpack` or `karma-preprocessor-rollup`.
- Test's are organized by top level describe blocks instead of test files.
  this means `.only` tests apply to the entire test suite, and snapshots are located in a **single directory** organized by suite name, instead of file name.
- module mocking does **not** work! You can use something specific to your preprocessor if you need.

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