chai-files
file system assertions for chai
Installation
npm install --save-dev chai-files
Usage
After importing chai
add the following code to use chai-files
assertions:
var chai = ;var chaiFiles = ; chai; var expect = chaiexpect;var file = chaiFilesfile;var dir = chaiFilesdir;
.to.exist
Check if a file or directory exist:
toexist;tonotexist; toexist;tonotexist;
.to.equal(...)
Check if the file content equals a string:
to;tonot; to;tonot;
.to.equal(file(...))
Check if the file equals another file:
to;tonot;
.to.be.empty
Check if a file or directory is empty:
tobeempty;tonotbeempty; tobeempty;tonotbeempty;
.to.contain(...)
Check if a file contains a string:
to;tonot;
.to.match(/.../)
Check if a file matches a regular expression:
to;tonot;
License
chai-files is licensed under the MIT License.