yeoman-assert
is extending the native Node.js assert
module. Every methods in assert
also is available with yeoman-assert
, plus some code scaffolding related assertion helpers.
Install
$ npm install yeoman-assert
Usage
const assert = ; ;assert;
API
assert.file()
- path (String|Array) Path to a file.
Assert that a file exists.
assert;
Assert that each files in the array exists.
assert;
assert.noFile()
- path (String|Array) Path to a file.
Assert that a file doesn't exists.
assert;
Assert that each of an array of files doesn't exist.
assert;
assert.fileContent()
- file (String|Array) Path to a file.
- reg (Regex|String) Regex or string that will be used to search the file.
Assert that a file's content matches a string.
assert;
Assert that a file's content matches a regex.
assert;
Assert that each of an array of files content matches a regex or string.
assert;
assert.noFileContent()
- file (String|Array) Path to a file.
- reg (Regex|String) Regex or string that will be used to search the file.
Assert that a file's content does not match a string.
assert;
Assert that a file's content does not match a regex.
assert;
Assert that each of an array of files content does not match a regex or string.
assert;
assert.textEqual()
- value (String) A string.
- expected (String) The expected value of the string.
Assert that two strings are equal after standardization of newlines.
assert;
assert.implement()
- subject (Object) Subject implementing the façade.
- methods (Object|Array) A façace, hash or array of keys to be implemented.
Assert an Object implements an interface.
assert;
assert.notImplement()
- subject (Object) Subject not implementing the methods.
- methods (Object|Array) Hash or array of method names to be implemented.
Assert an Object doesn't implements any method of an interface.
assert;
assert.objectContent()
Assert an object contains at least a set of keys
var anObject = a: 1; assert;
assert.noObjectContent()
Assert an object does not contain at least a set of keys
var anObject = a: 1; assert;
assert.jsonFileContent()
Assert a JSON file contains at least a set of keys (rely of assert.objectContent()
)
assert;
assert.noJsonFileContent()
Assert a JSON file does not contain at least a set of keys (rely of assert.noObjectContent()
)
assert;
Contribute
See the contributing docs.
License
BSD-2-Clause © Google