# @zanminkian/powerful-jest

> Make jest powerful.

Latest version **0.2.0** (published 2023-05-19) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @zanminkian/powerful-jest
pnpm add @zanminkian/powerful-jest
yarn add @zanminkian/powerful-jest
bun add @zanminkian/powerful-jest
```

Provides the command `jest`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2023-05-19 |
| First published | 2023-03-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 7 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hellozmj@qq.com |
| Maintainers | zanminkian |
| Keywords | testing, typescript, jest, easy-to-use, ts-jest |

## Links

- npm: https://www.npmjs.com/package/@zanminkian/powerful-jest
- Homepage: https://github.com/zanminkian/powerful-jest
- npm.io page: https://npm.io/package/@zanminkian/powerful-jest

## Dependencies (7)

- [jest](https://npm.io/package/jest.md) ^29.5.0
- [yargs](https://npm.io/package/yargs.md) ^17.7.2
- [ts-jest](https://npm.io/package/ts-jest.md) ^29.1.0
- [supertest](https://npm.io/package/supertest.md) ^6.3.3
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) ^8.1.3
- [@jest/globals](https://npm.io/package/@jest/globals.md) ^29.5.0
- [@types/supertest](https://npm.io/package/@types/supertest.md) ^2.0.12

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2023-05-19
- 0.1.12 — 2023-05-16
- 0.1.12-beta.0 — 2023-05-16
- 0.1.11 — 2023-05-06
- 0.1.10 — 2023-04-23
- 0.1.9 — 2023-04-19
- 0.1.8 — 2023-04-19
- 0.1.7 — 2023-04-08
- 0.1.6 — 2023-03-20
- 0.1.5 — 2023-03-20
- 0.1.4 — 2023-03-15
- 0.1.3 — 2023-03-14
- 0.1.2 — 2023-03-14
- 0.1.1 — 2023-03-13
- 0.1.0 — 2023-03-13
- … 4 more at https://npm.io/package/@zanminkian/powerful-jest/versions

## README

# @zanminkian/powerful-jest

[![License](https://img.shields.io/npm/l/@zanminkian/powerful-jest.svg)](https://github.com/zanminkian/powerful-jest/blob/main/LICENSE)
[![Version](https://img.shields.io/npm/v/@zanminkian/powerful-jest.svg)](https://www.npmjs.com/package/@zanminkian/powerful-jest)
[![Downloads](https://img.shields.io/npm/dm/@zanminkian/powerful-jest.svg)](https://www.npmjs.com/package/@zanminkian/powerful-jest)
[![Dependencies](https://img.shields.io/librariesio/release/npm/@zanminkian/powerful-jest)](https://www.npmjs.com/package/@zanminkian/powerful-jest)
[![Size](https://packagephobia.com/badge?p=@zanminkian/powerful-jest)](https://packagephobia.com/result?p=@zanminkian/powerful-jest)

> `@zanminkian/powerful-jest` is now `typed-jest`. Use `typed-jest` instead.

Empower your Jest testing experience.

## Features

- 100% compatible with [Jest](https://jestjs.io/). Use `@zanminkian/powerful-jest` just like you would use `jest`.
- Out-of-the-box TypeScript support.
- Sensible defaults adhering to best practices. Most projects work seamlessly with **zero configuration**.
- Integrated [supertest](https://www.npmjs.com/package/supertest) in it.

## Usage

1. Uninstall `jest`, `@types/jest`, and `ts-jest` if they are already installed in your project.

```sh
pnpm remove jest @types/jest ts-jest
```

2. Install `@zanminkian/powerful-jest`.
```sh
pnpm add -D @zanminkian/powerful-jest
```

3. Create an `app.ts` file.

```typescript
import express from 'express'

const app = express()
app.use((req, res) => {
  res.json({ hello: 'world' })
})

export default app
```

4. Create an `app.spec.ts` file.

```typescript
import { describe, beforeEach, it, expect, supertest } from '@zanminkian/powerful-jest'
import app from './app'

describe('app', () => {
  beforeEach(() => {
    // This will be executed before each test case.
  })

  afterEach(() => {
    jest.resetAllMocks()
  })

  it('should be 2', () => {
    expect(1 + 1).toBe(2)
  })
  it('should success', () => {
    supertest(app).get('/').expect({ hello: 'world' })
  })
})
```

5. Run `pnpm jest` to execute tests.

## Configuration

1. Add more CLI configurations after the `pnpm jest` command. For example, run `pnpm jest --coverage` to collect test coverage. Run `pnpm jest -h` for more CLI options information.
2. Add a `jest.config.js` file in the root of your project. Consult the [official Jest documentation](https://jestjs.io/docs/configuration) for more information.

## How it works

If you don't include CLI options when running `pnpm jest`, we will append some sensible defaults:
- `--transform='{"^.+\\\\.tsx?$":"ts-jest"}'`: This option transforms TypeScript files, so you can support TypeScript projects without additional configurations or installations.
- `--passWithNoTests`: This option prevents the CLI from producing errors if no tests are found. You can override this default by `pnpm jest --passWithNoTests=false`.
- `--collectCoverageFrom='**/src/**/*.{(j|t)s,(j|t)sx}'`: This option specifies the location for collecting test coverage. Override it as needed: `pnpm jest --collectCoverageFrom='**/lib/**/*.js'`

## License

MIT

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