Skip to content

Releases: kettanaito/fs-teardown

v0.3.0

17 Nov 23:54
Compare
Choose a tag to compare

Breaking changes

  • The createTeardown function now accepts a single argument—the options object with the required rootDir property.
import { createTeardown } from 'fs-teardown'

const api = createTeardown({
  rootDir: 'my-test',
})
  • Use the paths property in the createTeardown options to describe the initial directory structure:
const api = createTeardown({
  rootDir: 'my-test',
  paths: {
    'package.json': JSON.stringify({ name: 'my-test' })
  }
})
  • Relative paths in rootDir are now created against the system's default directory for temporary files (os.tmpdir). Use absolute paths to specify exact directory paths.
  • getPath was replaced with resolve to resemble the fs module:
-api.getPath('file.txt')
+api.resolve('file.txt')
  • The content of the JSON files can no longer be described using objects, it must be a string (use JSON.stringify()).
  • The following functions were removed:
    • addFile
    • addDirectory
  • Use .create() to create new files and directories.

Features

  • Adds .readFile() to get the content of the given file (#13).
  • Adds .edit() method to emulate reading and writing to the given file.
  • Adds .reset() method to reset the entire file tree to its initial state (described via the paths option on createTeardown).

v0.2.0

25 Aug 12:44
Compare
Choose a tag to compare

Breaking changes

  • The baseDir argument of createTeardown now supports absolute paths (#4). Relative paths are still resolved against process.cwd() as before.