Sha256: 6ce0b706e5bc41ba3d3578f56cbd843ba311e2d49a1a7d23f03a3890c0f73af1

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

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

test('global', function (t) {
    t.plan(2);
    
    var b = browserify();
    b.add(__dirname + '/global/main.js');
    b.bundle(function (err, src) {
        var c = {
            t : t,
            a : 555,
        };
        c.window = c;
        vm.runInNewContext(src, c);
    });
});

test('__filename and __dirname', function (t) {
    t.plan(2);
    
    var b = browserify();
    b.expose('x', __dirname + '/global/filename.js');
    b.bundle(function (err, src) {
        var c = {};
        vm.runInNewContext(src, c);
        var x = c.require('x');
        t.equal(x.filename, '/filename.js');
        t.equal(x.dirname, '/');
    });
});

test('process.nextTick', function (t) {
    t.plan(1);
    
    var b = browserify();
    b.add(__dirname + '/global/tick.js');
    b.bundle(function (err, src) {
        var c = { t: t, setTimeout: setTimeout };
        vm.runInNewContext(src, c);
    });
});

test('Buffer', function (t) {
    t.plan(2);
    
    var b = browserify();
    b.add(__dirname + '/global/buffer.js');
    b.bundle(function (err, src) {
        var c = { t: t };
        vm.runInNewContext(src, c);
    });
});

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
sprockets-browserify-0.2.0 node_modules/browserify/test/global.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/test/global.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/test/global.js