Sha256: 3415e564557c0be5d75a239544c0bd31074dc55c4ae1cbc73c87d34671336508

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

var test = require('tap').test;
var spawn = require('child_process').spawn;
var path = require('path');
var fs = require('fs');
var vm = require('vm');
var concat = require('concat-stream');

var temp = require('temp');
temp.track();
var tmpdir = temp.mkdirSync({prefix: 'browserify-test'});

fs.writeFileSync(tmpdir + '/main.js', 'beep(require("crypto"))\n');

test('crypto --insertGlobals', function (t) {
    t.plan(2);
    
    var bin = __dirname + '/../bin/cmd.js';
    var ps = spawn(process.execPath, [ bin, 'main.js', '--ig' ], { cwd : tmpdir });
    
    ps.stderr.pipe(process.stderr, { end : false });
    
    ps.on('exit', function (code) {
        t.equal(code, 0);
    });
    
    ps.stdout.pipe(concat(function (src) {
        var c = {
            Int32Array: Int32Array,
            ArrayBuffer: ArrayBuffer,
            Uint8Array: Uint8Array,
            DataView: DataView,
            beep : function (c) {
                t.equal(typeof c.createHash, 'function');
            },
            require: function () {}
        };
        vm.runInNewContext(src.toString('utf8'), c);
    }));
});

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
minimum_viable_product-0.0.11 test/dummy/node_modules/browserify/test/crypto_ig.js
brwy_rails-0.0.6 test/dummy/node_modules/browserify/test/crypto_ig.js
brwy_rails-0.0.5 test/dummy/node_modules/browserify/test/crypto_ig.js
brwy_rails-0.0.4 test/dummy/node_modules/browserify/test/crypto_ig.js
brwy_rails-0.0.3 test/dummy/node_modules/browserify/test/crypto_ig.js
brwy_rails-0.0.2 test/dummy/node_modules/browserify/test/crypto_ig.js
brwy_rails-0.0.1 test/dummy/node_modules/browserify/test/crypto_ig.js