buddy

node MVC discord bot
Log | Files | Refs | README

pathfilter.js (1085B)


      1 var test = require('tape');
      2 var resolve = require('../');
      3 
      4 test('#62: deep module references and the pathFilter', function(t){
      5 	t.plan(9);
      6     
      7 	var resolverDir = __dirname + '/pathfilter/deep_ref';
      8 	var pathFilter = function(pkg, x, remainder){
      9 		t.equal(pkg.version, "1.2.3");
     10 		t.equal(x, resolverDir + '/node_modules/deep/ref');
     11 		t.equal(remainder, "ref");
     12 		return "alt";
     13 	};
     14 	
     15 	resolve('deep/ref', { basedir : resolverDir }, function (err, res, pkg) {
     16         if (err) t.fail(err);
     17 
     18         t.equal(pkg.version, "1.2.3");
     19         t.equal(res, resolverDir + '/node_modules/deep/ref.js');
     20     });
     21 
     22     resolve('deep/deeper/ref', { basedir: resolverDir },
     23     function(err, res, pkg) {
     24       if(err) t.fail(err);
     25       t.notEqual(pkg, undefined);
     26       t.equal(pkg.version, "1.2.3");
     27       t.equal(res, resolverDir + '/node_modules/deep/deeper/ref.js');
     28     });
     29     
     30     resolve('deep/ref', { basedir : resolverDir, pathFilter : pathFilter },
     31     function (err, res, pkg) {
     32         if (err) t.fail(err);
     33         t.equal(res, resolverDir + '/node_modules/deep/alt.js');
     34     });
     35 });