This package adds file system matchers to Jest.
This package is available on npm as jest-extended-fs
.
npm install -D jest jest-extended-fs
In your Jest configuration file (e.g. jest.config.ts
), for each matcher you want to enable, add the matcher to the setupFilesAfterEnv
setting.
const config = {
setupFilesAfterEnv = ['jest-extended-fs/matchers/toBeAFile.js']
};
Follow the "Individual Matchers" instructions above using jest-extended-fs
instead of any specific matcher.
const config = {
setupFilesAfterEnv = ['jest-extended-fs']
};
.toExist()
.toBeADirectory()
.toBeADirectoryContaining(contents)
.toBeAnEmptyDirectory()
.toBeAFile()
.toBeAFileContaining(text)
.toBeAnEmptyFile()
.toHaveMode(mode)
.toBeExecutable()
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
This package is licensed under the MIT License.