Sha256: b04109973302df6e63dc165570b1680ec7a1384a3c0c05c00a948c59f2d886e9

Contents?: true

Size: 769 Bytes

Versions: 69

Compression:

Stored size: 769 Bytes

Contents

var path = require('path');
var test = require('tape');
var resolve = require('../');

test('filter', function (t) {
    var dir = path.join(__dirname, 'resolver');
    var packageFilterArgs;
    var res = resolve.sync('./baz', {
        basedir: dir,
        packageFilter: function (pkg, dir) {
            pkg.main = 'doom';
            packageFilterArgs = [pkg, dir];
            return pkg;
        }
    });

    t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works');

    var packageData = packageFilterArgs[0];
    t.equal(packageData.main, 'doom', 'package "main" was altered');

    var packageFile = packageFilterArgs[1];
    t.equal(packageFile, path.join(dir, 'baz'), 'second packageFilter argument is "dir"');

    t.end();
});

Version data entries

69 entries across 69 versions & 10 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/resolve/test/filter_sync.js
disco_app-0.18.2 test/dummy/node_modules/resolve/test/filter_sync.js
disco_app-0.16.1 test/dummy/node_modules/postcss-import/node_modules/resolve/test/filter_sync.js
disco_app-0.15.2 test/dummy/node_modules/postcss-import/node_modules/resolve/test/filter_sync.js
disco_app-0.18.4 test/dummy/node_modules/postcss-import/node_modules/resolve/test/filter_sync.js
disco_app-0.18.1 test/dummy/node_modules/postcss-import/node_modules/resolve/test/filter_sync.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/postcss-import/node_modules/resolve/test/filter_sync.js
disco_app-0.14.0 test/dummy/node_modules/postcss-import/node_modules/resolve/test/filter_sync.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/postcss-import/node_modules/resolve/test/filter_sync.js
condenser-0.0.8 lib/condenser/processors/node_modules/resolve/test/filter_sync.js
learn_create-0.0.22 lib/templates/javascript_lab_template/node_modules/resolve/test/filter_sync.js
jester-data-8.0.0 node_modules/resolve/test/filter_sync.js
ezii-os-5.2.1 node_modules/resolve/test/filter_sync.js
ezii-os-2.0.1 node_modules/resolve/test/filter_sync.js
ezii-os-1.1.0 node_modules/resolve/test/filter_sync.js
ezii-os-1.0.0 node_modules/resolve/test/filter_sync.js
condenser-0.0.7 lib/condenser/processors/node_modules/resolve/test/filter_sync.js
ezii-os-0.0.0.1.0 node_modules/resolve/test/filter_sync.js
ezii-os-0.0.0.0.1 node_modules/resolve/test/filter_sync.js
govuk_publishing_components-18.0.0 node_modules/resolve/test/filter_sync.js