Skip to content

Commit

Permalink
[Tests] fix pathfilter_sync tests for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bouk authored and ljharb committed Mar 23, 2016
1 parent 6cd0f25 commit 220fa7d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/pathfilter_sync.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
var test = require('tape');
var path = require('path');
var resolve = require('../');

test('synchronous pathfilter', function (t) {
var res;
var resolverDir = __dirname + '/pathfilter/deep_ref';
var pathFilter = function (pkg, x, remainder) {
t.equal(pkg.version, '1.2.3');
t.equal(x, resolverDir + '/node_modules/deep/ref');
t.equal(x, path.join(resolverDir, 'node_modules', 'deep', 'ref'));
t.equal(remainder, 'ref');
return 'alt';
};

res = resolve.sync('deep/ref', { basedir: resolverDir });
t.equal(res, resolverDir + '/node_modules/deep/ref.js');
t.equal(res, path.join(resolverDir, 'node_modules', 'deep', 'ref.js'));

res = resolve.sync('deep/deeper/ref', { basedir: resolverDir });
t.equal(res, resolverDir + '/node_modules/deep/deeper/ref.js');
t.equal(res, path.join(resolverDir, 'node_modules', 'deep', 'deeper', 'ref.js'));

res = resolve.sync('deep/ref', { basedir: resolverDir, pathFilter: pathFilter });
t.equal(res, resolverDir + '/node_modules/deep/alt.js');
t.equal(res, path.join(resolverDir, 'node_modules', 'deep', 'alt.js'));
t.end();
});

0 comments on commit 220fa7d

Please sign in to comment.