Fuzzer for testing NodeJS apps with mocha.
 
Go to file
Keith Irwin 1259b55154
Added tests
2018-02-23 22:29:33 +00:00
.gitignore Added packed packages to gitignore 2018-02-23 18:38:41 +00:00
LICENSE.md Initial commit 2018-02-20 05:02:58 +00:00
README.md Added tests 2018-02-23 22:29:33 +00:00
index.js Added tests 2018-02-23 22:29:33 +00:00
package-lock.json Added package-lock 2018-02-23 22:29:16 +00:00
package.json Added tests 2018-02-23 22:29:33 +00:00
test.js Added tests 2018-02-23 22:29:33 +00:00

README.md

mocha-froth

v0.1.1

Keith Irwin

Fuzzer for mocha testing. Or any javascript testing suite, really. This package provides a function that returns an array of random strings. You know, a fuzzer.

Installation

npm install mocha-froth

Usage

Import froth into your project

const froth = require('mocha-froth')

Use the syntax froth(num, max, opt)where:

  • num is the number of strings generated
  • max is the maximum string length
  • opt is an object of options for characters to include
opt = {
	// Set to true to include tests with...
	none: true, // Empty string
	whitespace: true, // Various whitespace chars
	quotes: true, // Combinations of quotes
	backslashing: true, // Combinations of backslashes
	symbols: true, // Various symbols
	foreign: true, // Foreign chars
	alphanumeric: true, // Ordinary letters and numbers
}

Examples

Create ten random strings, each up to twenty characters (default):

console.log( froth() )
// [ '``8\\ёðNàЧ,', 'µ', '\\,нcy', '?O¬ìè¶ſ\r4á%"Е~', '', 'ИôAàяjùgzH%хйf', 'd\r\nïЧо', '«&pcj→ъгPfЬа|h', 'ñgMſииe&?“3ьXî¢òдq<ц', 'Un5tĸ' ]

Create five strings up to ten characters:

console.log( froth(5,10) )
// [ '¢m\'\'\'ý7\'', 'óé€с-', 'фяþnЭOо', '', 'ykUбáФ¿ŷ¢С' ]

Same as above, but without foreign characters:

console.log( froth(5,10,{foreign:false}) )
// [ 'VP"""t¬mK²', '²L6)>\r\nV', 'v,→“', '*e8', '→' ]

Testing

npm test