Sha256: cbc81739562be19de6fbb9434bdb7ff32b4926b3e6ebe1161bdfd684d78a779a

Contents?: true

Size: 535 Bytes

Versions: 4

Compression:

Stored size: 535 Bytes

Contents

/**
 * In node.js `this` on the module root is the same as `exports`. Browser-pack
 * should act like it too.
 **/
var test = require('tape');
var pack = require('../');

test('this', function (t) {
    t.plan(1);

    var p = pack();
    var src = '';
    p.on('data', function (buf) { src += buf; });
    p.on('end', function () {
        var r = Function([], 'return ' + src)();
        t.deepEqual(r("abc"), { foo: "bar" });
    });

    p.end(JSON.stringify([{
        id: 'abc',
        source: 'this.foo = "bar"'
    }]));

});

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
sprockets-browserify-0.3.0 node_modules/browserify/node_modules/browser-pack/test/this.js
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/browser-pack/test/this.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/browser-pack/test/this.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/browser-pack/test/this.js