Sha256: 976dd6b9c8a207e2a7bf63d1a7e3eb5c369ce5f8a698549ef0e7b4ff08ab989a

Contents?: true

Size: 962 Bytes

Versions: 3

Compression:

Stored size: 962 Bytes

Contents

var test = require('tap').test;
var mdeps = require('module-deps');
var bpack = require('browser-pack');
var insert = require('../');
var vm = require('vm');

test('process.nextTick inserts', function (t) {
    t.plan(4);
    var files = [ __dirname + '/insert/main.js' ];
    var s = mdeps(files)
        .pipe(insert(files))
        .pipe(bpack({ raw: true }))
    ;
    var src = '';
    s.on('data', function (buf) { src += buf });
    s.on('end', function () {
        var c = { t: t, setTimeout: setTimeout };
        vm.runInNewContext(src, c);
    });
});

test('buffer inserts', function (t) {
    t.plan(2);
    var files = [ __dirname + '/insert/buffer.js' ];
    var s = mdeps(files)
        .pipe(insert(files))
        .pipe(bpack({ raw: true }))
    ;
    var src = '';
    s.on('data', function (buf) { src += buf });
    s.on('end', function () {
        var c = { t: t, setTimeout: setTimeout };
        vm.runInNewContext(src, c);
    });
});

Version data entries

3 entries across 3 versions & 2 rubygems

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