# @japa/file-system

> File system plugin for writing assertions for files and directories

Latest version **3.0.0** (published 2025-12-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @japa/file-system
pnpm add @japa/file-system
yarn add @japa/file-system
bun add @japa/file-system
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2025-12-13 |
| First published | 2023-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18.16.0 |
| Dependencies | 2 |
| Unpacked size | 24.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Author | Harminder Virk |
| Maintainers | virk, romainlanz, julien-r44 |
| Keywords | japa, test, file-system |

## Links

- npm: https://www.npmjs.com/package/@japa/file-system
- Repository: https://github.com/japa/file-system
- Homepage: https://github.com/japa/file-system#readme
- Issues: https://github.com/japa/file-system/issues
- npm.io page: https://npm.io/package/@japa/file-system

## Dependencies (2)

- [slash](https://npm.io/package/slash.md) ^5.1.0
- [@poppinss/macroable](https://npm.io/package/@poppinss/macroable.md) ^1.1.0

## 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
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2025-12-13
- 2.0.0-2 (next) — 2023-09-25
- 2.3.2 — 2025-01-08
- 2.3.1 — 2024-12-18
- 2.3.0 — 2024-04-01
- 2.2.0 — 2024-01-19
- 2.1.1 — 2023-12-24
- 2.1.0 — 2023-12-16
- 2.0.1 — 2023-11-06
- 2.0.0 — 2023-10-07
- 2.0.0-1 — 2023-06-28
- 2.0.0-0 — 2023-06-21
- 1.1.0 — 2023-06-12
- 1.0.1 — 2023-02-10
- 1.0.0 — 2023-02-10

## README

# @japa/file-system

> File system plugin for Japa

[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

The file system plugin allows you to easily manage files and directories during tests and write assertions against them.

#### [Complete API documentation](https://japa.dev/docs/plugins/file-system)

## Installation

You can install the plugin from the npm packages registry as follows.

```sh
npm i -D @japa/file-system
```

## Usage

The next step is registering the plugin inside the `plugins` array.

```ts
import { fileSystem } from '@japa/file-system'

configure({
  plugins: [fileSystem()],
})
```

Once the plugin has been registered, you can access the `fs` property from the test context. The `fs` property exposes the helper functions to **read** and **write** files. For example:

```ts
test('read rc file', async ({ fs }) => {
  await fs.write(
    'rc.json',
    JSON.stringify({
      foo: 'bar',
    })
  )

  await runMethodThatNeedsRcFile()
})
```

[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/japa/file-system/checks.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/japa/file-system/actions/workflows/checks.yml 'Github action'
[npm-image]: https://img.shields.io/npm/v/@japa/file-system/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://www.npmjs.com/package/@japa/file-system/v/latest 'npm'
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/japa/file-system?style=for-the-badge

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