Sha256: 084a0f83f8baaff0a918aa47f2eb4187251529ecd72ece0b4ba200d33e1e019a

Contents?: true

Size: 1.52 KB

Versions: 217

Compression:

Stored size: 1.52 KB

Contents

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

test('moduleDirectory strings', function (t) {
    t.plan(4);
    var dir = path.join(__dirname, 'module_dir');
    var xopts = {
        basedir: dir,
        moduleDirectory: 'xmodules'
    };
    resolve('aaa', xopts, function (err, res, pkg) {
        t.ifError(err);
        t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
    });

    var yopts = {
        basedir: dir,
        moduleDirectory: 'ymodules'
    };
    resolve('aaa', yopts, function (err, res, pkg) {
        t.ifError(err);
        t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
    });
});

test('moduleDirectory array', function (t) {
    t.plan(6);
    var dir = path.join(__dirname, 'module_dir');
    var aopts = {
        basedir: dir,
        moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
    };
    resolve('aaa', aopts, function (err, res, pkg) {
        t.ifError(err);
        t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
    });

    var bopts = {
        basedir: dir,
        moduleDirectory: ['zmodules', 'ymodules', 'xmodules']
    };
    resolve('aaa', bopts, function (err, res, pkg) {
        t.ifError(err);
        t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
    });

    var copts = {
        basedir: dir,
        moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
    };
    resolve('bbb', copts, function (err, res, pkg) {
        t.ifError(err);
        t.equal(res, path.join(dir, '/zmodules/bbb/main.js'));
    });
});

Version data entries

217 entries across 194 versions & 22 rubygems

Version Path
boring_generators-0.10.0 tmp/templates/app_template/node_modules/resolve/test/module_dir.js
trusty-cms-4.2.3 node_modules/resolve/test/module_dir.js
boring_generators-0.9.0 tmp/templates/app_template/node_modules/resolve/test/module_dir.js
tang-0.2.1 spec/tang_app/node_modules/resolve/test/module_dir.js
trusty-cms-4.2.2 node_modules/resolve/test/module_dir.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/resolve/test/module_dir.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/resolve/test/module_dir.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/resolve/test/module_dir.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/resolve/test/module_dir.js
boring_generators-0.8.0 tmp/templates/app_template/node_modules/resolve/test/module_dir.js
boring_generators-0.7.0 tmp/templates/app_template/node_modules/resolve/test/module_dir.js
trusty-cms-4.2.1 node_modules/resolve/test/module_dir.js
trusty-cms-4.2 node_modules/resolve/test/module_dir.js
trusty-cms-4.1.9 node_modules/resolve/test/module_dir.js
boring_generators-0.6.0 tmp/templates/app_template/node_modules/resolve/test/module_dir.js
trusty-cms-4.1.8 node_modules/resolve/test/module_dir.js
boring_generators-0.5.0 tmp/templates/app_template/node_modules/resolve/test/module_dir.js
tang-0.2.0 spec/tang_app/node_modules/resolve/test/module_dir.js
trusty-cms-4.1.7 node_modules/resolve/test/module_dir.js
boring_generators-0.4.0 tmp/templates/app_template/node_modules/resolve/test/module_dir.js