Sha256: 641173b2b73ae1ef03191d1fc8f55891458efee8ce246a0783ffeab54e4f787a

Contents?: true

Size: 859 Bytes

Versions: 7

Compression:

Stored size: 859 Bytes

Contents

var test = require('tap').test;
var pack = require('../');
var concat = require('concat-stream');

test('not found', function (t) {
    t.plan(6);
    
    var p = pack({ raw: true, hasExports: true });
    var src = '';
    p.pipe(concat(function (src) {
        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'/);
        try { r('zzz') }
        catch (err) { t.equal(err.code, 'MODULE_NOT_FOUND') }
    }));
    
    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

7 entries across 7 versions & 2 rubygems

Version Path
minimum_viable_product-0.0.11 test/dummy/node_modules/browser-pack/test/not_found.js
brwy_rails-0.0.6 test/dummy/node_modules/browser-pack/test/not_found.js
brwy_rails-0.0.5 test/dummy/node_modules/browser-pack/test/not_found.js
brwy_rails-0.0.4 test/dummy/node_modules/browser-pack/test/not_found.js
brwy_rails-0.0.3 test/dummy/node_modules/browser-pack/test/not_found.js
brwy_rails-0.0.2 test/dummy/node_modules/browser-pack/test/not_found.js
brwy_rails-0.0.1 test/dummy/node_modules/browser-pack/test/not_found.js