JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1706
  • Score
    100M100P100Q115473F
  • License MIT

File system plugin for writing assertions for files and directories

Package Exports

  • @japa/file-system

Readme

@japa/file-system

File system plugin for Japa

gh-workflow-image npm-image license-image

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

Complete API documentation

Installation

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

npm i -D @japa/file-system

Usage

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

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:

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

  await runMethodThatNeedsRcFile()
})