Fuzzer for testing NodeJS apps with mocha.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Keith Irwin 96895cd5cf
Bumped version
5 years ago
.gitignore Removed coverage folder from version control 5 years ago
.travis.yml Added coveralls 5 years ago
LICENSE.md Initial commit 5 years ago
README.md Added save-dev to install instructions 5 years ago
index.js Added tests 5 years ago
package-lock.json Added coveralls 5 years ago
package.json Bumped version 5 years ago
test.js Added tests 5 years ago



npm version Travis Build Status Coverage Status Snyk Vulnerabilities

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.


npm install --save-dev mocha-froth


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

mocha-froth will return an array of strings you can use to test your code.


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', '→' ]


npm test