115. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/2/2017 1:40:10 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

115.1 Files compared

# Location File Last Modified
1 chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip\node_modules\yargs\test parse.js Wed Nov 12 18:15:46 2014 UTC
2 chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip\node_modules\yargs\test parse.js Mon Oct 2 18:10:05 2017 UTC

115.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 776
Changed 1 2
Inserted 0 0
Removed 0 0

115.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

115.4 Active regular expressions

No regular expressions were active.

115.5 Comparison detail

  1   var should  = require ('chai').s hould(),
  2       yargs  = require( '../'),
  3       path =  require(' path');
  4  
  5   describe(' parse', fu nction ()  {
  6  
  7       it('sh ould pass  when speci fying a "s hort boole an"', func tion () {
  8           va r parse =  yargs.pars e([ '-b' ] );
  9           pa rse.should .have.prop erty('b'). to.be.ok.a nd.be.a('b oolean');
  10           pa rse.should .have.prop erty('_'). with.lengt h(0);
  11       });
  12  
  13       it('sh ould pass  when speci fying a "l ong boolea n"', funct ion () {
  14           va r parse =  yargs.pars e(['--bool ']);
  15           pa rse.should .have.prop erty('bool ', true);
  16           pa rse.should .have.prop erty('_'). with.lengt h(0);
  17       });
  18  
  19       it('sh ould place  bare opti ons in the  _ array',  function  () {
  20           va r parse =  yargs.pars e(['foo',  'bar', 'ba z']);
  21           pa rse.should .have.prop erty('_'). and.deep.e qual(['foo ','bar','b az']);
  22       });
  23  
  24       it('sh ould expan d grouped  short opti ons to a h ash with a  key for e ach', func tion () {
  25           va r parse =  yargs.pars e(['-cats' ]);
  26           pa rse.should .have.prop erty('c',  true);
  27           pa rse.should .have.prop erty('a',  true);
  28           pa rse.should .have.prop erty('t',  true);
  29           pa rse.should .have.prop erty('s',  true);
  30           pa rse.should .have.prop erty('_'). with.lengt h(0);
  31       });
  32  
  33       it('sh ould set t he value o f the fina l option i n a group  to the nex t supplied  value', f unction ()  {
  34           va r parse =  yargs.pars e(['-cats' , 'meow']) ;
  35           pa rse.should .have.prop erty('c',  true);
  36           pa rse.should .have.prop erty('a',  true);
  37           pa rse.should .have.prop erty('t',  true);
  38           pa rse.should .have.prop erty('s',  'meow');
  39           pa rse.should .have.prop erty('_'). with.lengt h(0);
  40       });
  41  
  42       it('sh ould set t he value o f a single  short opt ion to the  next supp lied value ', functio n () {
  43           va r parse =  yargs.pars e(['-h', ' localhost' ]);
  44           pa rse.should .have.prop erty('h',  'localhost ');
  45           pa rse.should .have.prop erty('_'). with.lengt h(0);
  46       });
  47  
  48       it('sh ould set t he value o f multiple  single sh ort option s to the n ext suppli ed values  relative t o each', f unction ()  {
  49           va r parse =  yargs.pars e(['-h', ' localhost' , '-p', '5 55']);
  50           pa rse.should .have.prop erty('h',  'localhost ');
  51           pa rse.should .have.prop erty('p',  555);
  52           pa rse.should .have.prop erty('_'). with.lengt h(0);
  53       });
  54  
  55       it('sh ould set t he value o f a single  long opti on to the  next suppl ied value' , function  () {
  56           va r parse =  yargs.pars e(['--pow' , 'xixxle' ]);
  57           pa rse.should .have.prop erty('pow' , 'xixxle' );
  58           pa rse.should .have.prop erty('_'). with.lengt h(0);
  59       });
  60  
  61       it('sh ould set t he value o f a single  long opti on if an =  was used' , function  () {
  62           va r parse =  yargs.pars e(['--pow= xixxle']);
  63           pa rse.should .have.prop erty('pow' , 'xixxle' );
  64           pa rse.should .have.prop erty('_'). with.lengt h(0);
  65       });
  66  
  67       it('sh ould set t he value o f multiple  long opti ons to the  next supp lied value s relative  to each',  function  () {
  68           va r parse =  yargs.pars e(['--host ', 'localh ost', '--p ort', '555 ']);
  69           pa rse.should .have.prop erty('host ', 'localh ost');
  70           pa rse.should .have.prop erty('port ', 555);
  71           pa rse.should .have.prop erty('_'). with.lengt h(0);
  72       });
  73  
  74       it('sh ould set t he value o f multiple  long opti ons if = s igns were  used', fun ction () {
  75             var parse  = yargs.pa rse(['--ho st=localho st', '--po rt= PORT ']);
  76           pa rse.should .have.prop erty('host ', 'localh ost');
  77           pa rse.should .have.prop erty('port ', 555);
  78           pa rse.should .have.prop erty('_'). with.lengt h(0);
  79       });
  80  
  81       it('sh ould still  set value s appropri ately if a  mix of sh ort, long,  and group ed short o ptions are  specified ', functio n () {
  82           va r parse =  yargs.pars e(['-h', ' localhost' , '-fp', ' 555', 'scr ipt.js']);
  83           pa rse.should .have.prop erty('f',  true);
  84           pa rse.should .have.prop erty('p',  555);
  85           pa rse.should .have.prop erty('h',  'localhost ');
  86           pa rse.should .have.prop erty('_'). and.deep.e qual(['scr ipt.js']);
  87       });
  88  
  89       it('sh ould still  set value s appropri ately if a  mix of sh ort and lo ng options  are speci fied', fun ction () {
  90           va r parse =  yargs.pars e(['-h', ' localhost' , '--port' , '555']);
  91           pa rse.should .have.prop erty('h',  'localhost ');
  92           pa rse.should .have.prop erty('port ', 555);
  93           pa rse.should .have.prop erty('_'). with.lengt h(0);
  94       });
  95  
  96       it('sh ould expli citly set  a boolean  option to  false if p receeded b y "--no-"' , function  () {
  97           va r parse =  yargs.pars e(['--no-m oo']);
  98           pa rse.should .have.prop erty('moo' , false);
  99           pa rse.should .have.prop erty('_'). with.lengt h(0);
  100       });
  101  
  102       it('sh ould group  values in to an arra y if the s ame option  is specif ied multip le times',  function  () {
  103           va r parse =  yargs.pars e(['-v', ' a', '-v',  'b', '-v',  'c' ]);
  104           pa rse.should .have.prop erty('v'). and.deep.e qual(['a', 'b','c']);
  105           pa rse.should .have.prop erty('_'). with.lengt h(0);
  106       });
  107  
  108       it('sh ould still  set value s appropri ately if w e supply a  comprehen sive list  of various  types of  options',  function ( ) {
  109           va r parse =  yargs.pars e([
  110                '--name= meowmers',  'bare', ' -cats', 'w oo',
  111                '-h', 'a wesome', ' --multi=qu ux',
  112                '--key',  'value',
  113                '-b', '- -bool', '- -no-meep',  '--multi= baz',
  114                '--', '- -not-a-fla g', 'eek'
  115           ]) ;
  116           pa rse.should .have.prop erty('c',  true);
  117           pa rse.should .have.prop erty('a',  true);
  118           pa rse.should .have.prop erty('t',  true);
  119           pa rse.should .have.prop erty('s',  'woo');
  120           pa rse.should .have.prop erty('h',  'awesome') ;
  121           pa rse.should .have.prop erty('b',  true);
  122           pa rse.should .have.prop erty('bool ', true);
  123           pa rse.should .have.prop erty('key' , 'value') ;
  124           pa rse.should .have.prop erty('mult i').and.de ep.equal([ 'quux', 'b az']);
  125           pa rse.should .have.prop erty('meep ', false);
  126           pa rse.should .have.prop erty('name ', 'meowme rs');
  127           pa rse.should .have.prop erty('_'). and.deep.e qual(['bar e', '--not -a-flag',  'eek']);
  128       });
  129  
  130       it('sh ould parse  numbers a ppropriate ly', funct ion () {
  131           va r argv = y args.parse ([
  132                '-x', '1 234',
  133                '-y', '5 .67',
  134                '-z', '1 e7',
  135                '-w', '1 0f',
  136                '--hex',  '0xdeadbe ef',
  137                '789',
  138           ]) ;
  139           ar gv.should. have.prope rty('x', 1 234).and.b e.a('numbe r');
  140           ar gv.should. have.prope rty('y', 5 .67).and.b e.a('numbe r');
  141           ar gv.should. have.prope rty('z', 1 e7).and.be .a('number ');
  142           ar gv.should. have.prope rty('w', ' 10f').and. be.a('stri ng');
  143           ar gv.should. have.prope rty('hex',  0xdeadbee f).and.be. a('number' );
  144           ar gv.should. have.prope rty('_').a nd.deep.eq ual([789]) ;
  145           ar gv._[0].sh ould.be.a( 'number');
  146       });
  147  
  148       it('sh ould not s et the nex t value as  the value  of a shor t option i f that opt ion is exp licitly de fined as a  boolean',  function  () {
  149           va r parse =  yargs([ '- t', 'moo'  ]).boolean (['t']).ar gv;
  150           pa rse.should .have.prop erty('t',  true).and. be.a('bool ean');
  151           pa rse.should .have.prop erty('_'). and.deep.e qual(['moo ']);
  152       });
  153  
  154       it('sh ould set b oolean opt ions value s if the n ext value  is "true"  or "false" ', functio n () {
  155           va r parse =  yargs(['-- verbose',  'false', ' moo', '-t' , 'true'])
  156                .boolean (['t', 've rbose']).d efault('ve rbose', tr ue).argv;
  157           pa rse.should .have.prop erty('verb ose', fals e).and.be. a('boolean ');
  158           pa rse.should .have.prop erty('t',  true).and. be.a('bool ean');
  159           pa rse.should .have.prop erty('_'). and.deep.e qual(['moo ']);
  160       });
  161  
  162       it('sh ould set b oolean opt ions to fa lse by def ault', fun ction () {
  163           va r parse =  yargs(['mo o'])
  164                .boolean (['t', 've rbose'])
  165                .default ('verbose' , false)
  166                .default ('t', fals e).argv;
  167           pa rse.should .have.prop erty('verb ose', fals e).and.be. a('boolean ');
  168           pa rse.should .have.prop erty('t',  false).and .be.a('boo lean');
  169           pa rse.should .have.prop erty('_'). and.deep.e qual(['moo ']);
  170       });
  171  
  172       it('sh ould allow  defining  options as  boolean i n groups',  function  () {
  173           va r parse =  yargs([ '- x', '-z',  'one', 'tw o', 'three ' ])
  174                .boolean (['x','y', 'z']).argv ;
  175           pa rse.should .have.prop erty('x',  true).and. be.a('bool ean');
  176           pa rse.should .have.prop erty('y',  false).and .be.a('boo lean');
  177           pa rse.should .have.prop erty('z',  true).and. be.a('bool ean');
  178           pa rse.should .have.prop erty('_'). and.deep.e qual(['one ','two','t hree']);
  179       });
  180  
  181       it('sh ould prese rve newlin es in opti on values'  , functio n () {
  182           va r args = y args.parse (['-s', "X \nX"]);
  183           ar gs.should. have.prope rty('_').w ith.length (0);
  184           ar gs.should. have.prope rty('s', ' X\nX');
  185           //  reproduce  in bash:
  186           //  VALUE="ne w
  187           //  line"
  188           //  node prog ram.js --s ="$VALUE"
  189           ar gs = yargs .parse(["- -s=X\nX"]) ;
  190           ar gs.should. have.prope rty('_').w ith.length (0);
  191           ar gs.should. have.prope rty('s', ' X\nX');
  192       });
  193  
  194       it('sh ould not c onvert num bers to ty pe number  if explici tly define d as strin gs' , func tion () {
  195           va r s = yarg s([ '-s',  '0001234'  ]).string( 's').argv. s;
  196           s. should.be. a('string' ).and.equa l('0001234 ');
  197           va r x = yarg s([ '-x',  '56' ]).st ring('x'). argv.x;
  198           x. should.be. a('string' ).and.equa l('56');
  199       });
  200  
  201       it('sh ould leave  all non-h yphenated  values as  strings if  _ is defi ned as a s tring', fu nction ()  {
  202           va r s = yarg s([ '  ',  '  ' ]).st ring('_'). argv._;
  203           s. should.hav e.length(2 );
  204           s[ 0].should. be.a('stri ng').and.e qual('  ') ;
  205           s[ 1].should. be.a('stri ng').and.e qual('  ') ;
  206       });
  207  
  208       it('sh ould norma lize redun dant paths ', functio n () {
  209           va r a = yarg s([ '-s',  '/tmp/../'  ]).alias( 's', 'save ').normali ze('s').ar gv;
  210           a. should.hav e.property ('s', '/') ;
  211           a. should.hav e.property ('save', ' /');
  212       });
  213  
  214       it('sh ould norma lize redun dant paths  when a va lue is lat er assigne d', functi on () {
  215           va r a = yarg s(['-s']). normalize( 's').argv;
  216           a. should.hav e.property ('s', true );
  217           a. s = '/path /to/new/di r/../../';
  218           a. s.should.e qual('/pat h/to/');
  219       });
  220  
  221       it('sh ould assig n data aft er forward  slash to  the option  before th e slash',  function ( ) {
  222           va r parse =  yargs.pars e(['-I/foo /bar/baz'] );
  223           pa rse.should .have.prop erty('_'). with.lengt h(0);
  224           pa rse.should .have.prop erty('I',  '/foo/bar/ baz');
  225           pa rse = yarg s.parse([' -xyz/foo/b ar/baz']);
  226           pa rse.should .have.prop erty('x',  true);
  227           pa rse.should .have.prop erty('y',  true);
  228           pa rse.should .have.prop erty('z',  '/foo/bar/ baz');
  229           pa rse.should .have.prop erty('_'). with.lengt h(0);
  230       });
  231  
  232       it('sh ould set a lias value  to the sa me value a s the full  option',  function ( ) {
  233           va r argv = y args([ '-f ', '11', ' --zoom', ' 55' ])
  234                .alias(' z', 'zoom' )
  235                .argv;
  236           ar gv.should. have.prope rty('zoom' , 55);
  237           ar gv.should. have.prope rty('z', 5 5);
  238           ar gv.should. have.prope rty('f', 1 1);
  239       });
  240  
  241       /*
  242        *it(' should loa d options  and values  from a fi le when co nfig is us ed', funct ion () {
  243        *     var argv =  yargs([ ' --settings ', '../tes t/config.j son', '--f oo', 'bar'  ])
  244        *         .alias ('z', 'zoo m')
  245        *         .confi g('setting s')
  246        *         .argv;
  247        *     argv.shoul d.have.pro perty('her p', 'derp' );
  248        *     argv.shoul d.have.pro perty('zoo m', 55);
  249        *     argv.shoul d.have.pro perty('foo ').and.dee p.equal([' baz','bar' ]);
  250        *});
  251        */
  252  
  253       it('sh ould allow  multiple  aliases to  be specif ied', func tion () {
  254           va r argv = y args([ '-f ', '11', ' --zoom', ' 55' ])
  255                .alias(' z', [ 'zm' , 'zoom' ] )
  256                .argv;
  257           ar gv.should. have.prope rty('zoom' , 55);
  258           ar gv.should. have.prope rty('z', 5 5);
  259           ar gv.should. have.prope rty('zm',  55);
  260           ar gv.should. have.prope rty('f', 1 1);
  261       });
  262  
  263       it('sh ould defin e option a s boolean  and set de fault to t rue', func tion () {
  264           va r argv = y args.optio ns({
  265                sometrue : {
  266                    bool ean: true,
  267                    defa ult: true
  268                }
  269           }) .argv;
  270           ar gv.should. have.prope rty('somet rue', true );
  271       });
  272  
  273       it('sh ould defin e option a s boolean  and set de fault to f alse', fun ction () {
  274           va r argv = y args.optio ns({
  275                somefals e: {
  276                    bool ean: true,
  277                    defa ult: false
  278                }
  279           }) .argv;
  280           ar gv.should. have.prope rty('somef alse', fal se);
  281       });
  282  
  283       it('sh ould allow  object gr aph traver sal via do t notation ', functio n () {
  284           va r argv = y args([
  285                '--foo.b ar', '3',  '--foo.baz ', '4',
  286                '--foo.q uux.quibbl e', '5', ' --foo.quux .o_O',
  287                '--beep. boop'
  288           ]) .argv;
  289           ar gv.should. have.prope rty('foo') .and.deep. equal({
  290                bar: 3,
  291                baz: 4,
  292                quux: {
  293                    quib ble: 5,
  294                    o_O:  true
  295                }
  296           }) ;
  297           ar gv.should. have.prope rty('beep' ).and.deep .equal({ b oop: true  });
  298       });
  299  
  300       it('sh ould allow  booleans  and aliase s to be de fined with  chainable  api', fun ction () {
  301           va r aliased  = [ '-h',  'derp' ],
  302                regular  = [ '--her p',  'derp ' ],
  303                opts = {
  304                    herp : { alias:  'h', bool ean: true  }
  305                },
  306                aliasedA rgv = yarg s(aliased) .boolean(' herp').ali as('h', 'h erp').argv ,
  307                property Argv = yar gs(regular ).boolean( 'herp').al ias('h', ' herp').arg v;
  308           al iasedArgv. should.hav e.property ('herp', t rue);
  309           al iasedArgv. should.hav e.property ('h', true );
  310           al iasedArgv. should.hav e.property ('_').and. deep.equal (['derp']) ;
  311           pr opertyArgv .should.ha ve.propert y('herp',  true);
  312           pr opertyArgv .should.ha ve.propert y('h', tru e);
  313           pr opertyArgv .should.ha ve.propert y('_').and .deep.equa l(['derp'] );
  314       });
  315  
  316       it('sh ould allow  booleans  and aliase s to be de fined with  options h ash', func tion () {
  317           va r aliased  = [ '-h',  'derp' ],
  318                regular  = [ '--her p', 'derp'  ],
  319                opts = {
  320                    herp : { alias:  'h', bool ean: true  }
  321                },
  322                aliasedA rgv = yarg s(aliased) .options(o pts).argv,
  323                property Argv = yar gs(regular ).options( opts).argv ;
  324           al iasedArgv. should.hav e.property ('herp', t rue);
  325           al iasedArgv. should.hav e.property ('h', true );
  326           al iasedArgv. should.hav e.property ('_').and. deep.equal (['derp']) ;
  327           pr opertyArgv .should.ha ve.propert y('herp',  true);
  328           pr opertyArgv .should.ha ve.propert y('h', tru e);
  329           pr opertyArgv .should.ha ve.propert y('_').and .deep.equa l(['derp'] );
  330       });
  331  
  332       it('sh ould set b oolean and  alias usi ng explici t true', f unction ()  {
  333           va r aliased  = [ '-h',  'true' ],
  334                regular  = [ '--her p',  'true ' ],
  335                opts = {
  336                    herp : { alias:  'h', bool ean: true  }
  337                },
  338                aliasedA rgv = yarg s(aliased) .boolean(' h').alias( 'h', 'herp ').argv,
  339                property Argv = yar gs(regular ).boolean( 'h').alias ('h', 'her p').argv;
  340           al iasedArgv. should.hav e.property ('herp', t rue);
  341           al iasedArgv. should.hav e.property ('h', true );
  342           al iasedArgv. should.hav e.property ('_').with .length(0) ;
  343       });
  344  
  345       // reg ression, s ee https:/ /github.co m/substack /node-opti mist/issue s/71
  346       it('sh ould set b oolean and  --x=true' , function () {
  347           va r parsed =  yargs(['- -boool', ' --other=tr ue']).bool ean('boool ').argv;
  348           pa rsed.shoul d.have.pro perty('boo ol', true) ;
  349           pa rsed.shoul d.have.pro perty('oth er', 'true ');
  350           pa rsed = yar gs(['--boo ol', '--ot her=false' ]).boolean ('boool'). argv;
  351           pa rsed.shoul d.have.pro perty('boo ol', true) ;
  352           pa rsed.shoul d.have.pro perty('oth er', 'fals e');
  353       });
  354  
  355       // reg ression, s ee https:/ /github.co m/chevex/y args/issue s/63
  356       it('sh ould not a dd the sam e key to a rgv multip le times,  when creat ing camel- case alias es', funct ion() {
  357         var  yargs = re quire('../ ')(['--hea lth-check= banana', ' --second-k ey', 'appl e', '-t=bl arg'])
  358              .options(' h', {
  359                alias: ' health-che ck',
  360                descript ion: 'heal th check',
  361                default:  'apple'
  362              })
  363              .options(' second-key ', {
  364                alias: ' s',
  365                descript ion: 'seco nd key',
  366                default:  'banana'
  367              })
  368              .options(' third-key' , {
  369                alias: ' t',
  370                descript ion: 'thir d key',
  371                default:  'third'
  372              })
  373  
  374         // b efore this  fix, yarg s failed p arsing
  375         // o ne but not  all forms  of an arg .
  376         yarg s.argv.sec ondKey.sho uld.eql('a pple');
  377         yarg s.argv.s.s hould.eql( 'apple');
  378         yarg s.argv['se cond-key'] .should.eq l('apple') ;
  379  
  380         yarg s.argv.hea lthCheck.s hould.eql( 'banana');
  381         yarg s.argv.h.s hould.eql( 'banana');
  382         yarg s.argv['he alth-check '].should. eql('banan a');
  383  
  384         yarg s.argv.thi rdKey.shou ld.eql('bl arg');
  385         yarg s.argv.t.s hould.eql( 'blarg');
  386         yarg s.argv['th ird-key']. should.eql ('blarg');
  387       });
  388  
  389   });