Sha256: d7e51d8820e3a919fd34ede446ad58ab2325578aab1d34e2132783e3b8c9eaf7

Contents?: true

Size: 1.02 KB

Versions: 158

Compression:

Stored size: 1.02 KB

Contents

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

test('filter', function (t) {
    t.plan(4);
    var dir = path.join(__dirname, 'resolver');
    var packageFilterArgs;
    resolve('./baz', {
        basedir: dir,
        packageFilter: function (pkg, pkgfile) {
            pkg.main = 'doom'; // eslint-disable-line no-param-reassign
            packageFilterArgs = [pkg, pkgfile];
            return pkg;
        }
    }, function (err, res, pkg) {
        if (err) t.fail(err);

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

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

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

        t.end();
    });
});

Version data entries

158 entries across 141 versions & 14 rubygems

Version Path
immosquare-cleaner-0.1.62 node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.61 node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.60 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.60 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.59 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.59 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.58 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.58 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.57 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.57 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.56 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.56 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.55 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.55 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.54 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.54 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.53 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.53 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.52 node_modules/eslint-import-resolver-node/node_modules/resolve/test/filter.js
immosquare-cleaner-0.1.52 node_modules/@babel/helper-define-polyfill-provider/node_modules/resolve/test/filter.js