You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lloyd Brookes edited this page Nov 27, 2017
·
1 revision
Demonstrates use in a mocha test script.
constassert=require('assert')constcommandLineArgs=require('command-line-args')/*enable partial parsing to prevent `UNKNOWN_OPTION` exceptions being thrownif the user sets mocha-specific options (e.g. --no-colors)*/constoptions=commandLineArgs({name: 'value',type: Number},{partial: true})describe('Array',function(){describe('#indexOf()',function(){it('should pass when the supplied value is between 1 and 3',function(){assert.ok([1,2,3].indexOf(options.value)>-1)})})})
Example output.
$ mocha example/mocha.js --value 3 --no-colors
Array
#indexOf()
✓ should pass when the supplied value is between 1 and 3
1 passing (7ms)