Sha256: 0e26cc7dbe43173f5f417de1c7498650cf4d5d6aa83f57b981ac2dec2a35f59e

Contents?: true

Size: 748 Bytes

Versions: 4

Compression:

Stored size: 748 Bytes

Contents

var test = require('tape');
var pack = require('../');

test('raw', function (t) {
    t.plan(5);
    
    var p = pack({ raw: true });
    var src = '';
    p.on('data', function (buf) { src += buf });
    p.on('end', function () {
        var r = Function(['T'], 'return ' + src)(t);
        t.equal(r('xyz')(5), 555);
        t.equal(r('xyz')(5), 555);
        t.throws(function() {
            r('zzz');
        }, /Cannot find module 'zzz'/);
    });
    
    p.write({
        id: 'abc',
        source: 'T.equal(require("./xyz")(3), 333)',
        entry: true,
        deps: { './xyz': 'xyz' }
    });
    
    p.write({
        id: 'xyz',
        source: 'T.ok(true); module.exports=function(n){return n*111}'
    });
    
    p.end();
});

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/raw.js
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/browser-pack/test/raw.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/browser-pack/test/raw.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/browser-pack/test/raw.js