Sha256: 06fb009055089ac2ba3ed65c74b9ad54aca21f53fe5a3d4ca048dc466dc22745

Contents?: true

Size: 1.21 KB

Versions: 7

Compression:

Stored size: 1.21 KB

Contents

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

test('process.nextTick inserts', function (t) {
    t.plan(4);
    var s = mdeps()
    s.pipe(bpack({ raw: true })).pipe(concat(function (src) {
        var c = {
            t: t,
            setTimeout: setTimeout,
            clearTimeout: clearTimeout
        };
        vm.runInNewContext(src, c);
    }));
    s.write({ transform: inserter, global: true })
    s.end(__dirname + '/insert/main.js');
});

test('buffer inserts', function (t) {
    t.plan(2);
    var s = mdeps({
        modules: { buffer: require.resolve('buffer/') }
    });
    s.pipe(bpack({ raw: true })).pipe(concat(function (src) {
        var c = {
            t: t,
            setTimeout: setTimeout,
            clearTimeout: clearTimeout,
            Uint8Array: Uint8Array,
            DataView: DataView
        };
        vm.runInNewContext(src, c);
    }));
    s.write({ transform: inserter, global: true })
    s.end(__dirname + '/insert/buffer.js');
});

function inserter (file) {
    return insert(file, {
        basedir: __dirname + '/insert'
    });
}

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
minimum_viable_product-0.0.11 test/dummy/node_modules/insert-module-globals/test/insert.js
brwy_rails-0.0.6 test/dummy/node_modules/insert-module-globals/test/insert.js
brwy_rails-0.0.5 test/dummy/node_modules/insert-module-globals/test/insert.js
brwy_rails-0.0.4 test/dummy/node_modules/insert-module-globals/test/insert.js
brwy_rails-0.0.3 test/dummy/node_modules/insert-module-globals/test/insert.js
brwy_rails-0.0.2 test/dummy/node_modules/insert-module-globals/test/insert.js
brwy_rails-0.0.1 test/dummy/node_modules/insert-module-globals/test/insert.js