Releases: kettanaito/fs-teardown
Releases · kettanaito/fs-teardown
v0.3.0
Breaking changes
- The
createTeardown
function now accepts a single argument—the options object with the requiredrootDir
property.
import { createTeardown } from 'fs-teardown'
const api = createTeardown({
rootDir: 'my-test',
})
- Use the
paths
property in thecreateTeardown
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 withresolve
to resemble thefs
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 thepaths
option oncreateTeardown
).