# enable-fixtures

> Enable fixtures (like Vitest, Playwright, or pytest) in Jest.

Latest version **0.0.1** (published 2023-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install enable-fixtures
pnpm add enable-fixtures
yarn add enable-fixtures
bun add enable-fixtures
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-10-23 |
| First published | 2023-10-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ryan Miller Galamb |
| Maintainers | rjmill |

## Links

- npm: https://www.npmjs.com/package/enable-fixtures
- npm.io page: https://npm.io/package/enable-fixtures

## Recent versions

- 0.0.1 (latest) — 2023-10-23

## README

# `enable-fixtures`

Enable fixtures (like Vitest, Playwright, or pytest) in Jest.

_ATTENTION: This is a proof of concept right now. Use at your own risk._

## Setup

Create a setup script with the following:

```
// content of testSetup.js
import { enableFixtures } from 'enable-fixtures'

enableFixtures(test, { mutate: true })
```

Then add the setup script to your Jest config's `setupFilesAfterEnv`. For example, when
configuring via `package.json`:

```
"jest": {
  "setupFilesAfterEnv": ["<rootDir>/testSetup.js"]
}
```

Now Jest's global `test` and `it` should have a `.extend` property added to them.

```
const myTest = test.extend({
  hello: "hello fixtures!",
  loudHello: async ({ hello }, use) => {
    await use(hello.toUpperCase())
  },
})

myTest("fixtures are working", ({ loudHello }) => {
  expect(loudHello).toBe("HELLO FIXTURES!")
})
```

## Usage

`enable-fixtures` is modeled after
[Vitest's test context](https://vitest.dev/guide/test-context.html#extend-test-context)
and [Playwright's fixtures](https://playwright.dev/docs/api/class-test#test-extend).

The main difference is that `enable-fixtures` doesn't provide any default fixtures.
Furthermore, `enable-fixtures` doesn't support Playwright's worker scope,
fixtures-options, or timeout. It **does**, however, support
[automatic fixtures](https://playwright.dev/docs/test-fixtures#automatic-fixtures)
via Playwright's tuple-like syntax.

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