Sha256: a5c864d317470a57cb1f20ab7f173e4b8f50dfc7f13137a6a90f5d9027764524

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

var browserify = require('../');
var vm = require('vm');
var test = require('tap').test;

test('only export require', function (t) {
    t.plan(1);
    var src = browserify().bundle();
    var c = {};
    vm.runInNewContext(src, c);
    t.same(Object.keys(c), [ 'require' ]);
});

test('no exports when entries are defined', function (t) {
    t.plan(1);
    var src = browserify(__dirname + '/export/entry.js').bundle();
    var c = {};
    vm.runInNewContext(src, c);
    t.same(c, {});
});

test('override require export', function (t) {
    t.plan(1);
    var src = browserify({ exports : [ 'require' ] })
        .addEntry(__dirname + '/export/entry.js')
        .bundle()
    ;
    var c = {};
    vm.runInNewContext(src, c);
    t.same(Object.keys(c), [ 'require' ]);
});

test('override process export', function (t) {
    t.plan(1);
    var src = browserify({ exports : [ 'process' ] })
        .addEntry(__dirname + '/export/entry.js')
        .bundle()
    ;
    var c = {};
    vm.runInNewContext(src, c);
    t.same(Object.keys(c), [ 'process' ]);
});

test('override require and process export', function (t) {
    t.plan(1);
    var src = browserify({ exports : [ 'require', 'process' ] })
        .addEntry(__dirname + '/export/entry.js')
        .bundle()
    ;
    var c = {};
    vm.runInNewContext(src, c);
    t.same(Object.keys(c).sort(), [ 'require', 'process' ].sort());
});

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
snowball-0.1.22 node_modules/browserify/test/export.js
sprockets-browserify-0.1.2 node_modules/browserify/test/export.js
sprockets-browserify-0.1.0 node_modules/browserify/test/export.js