Sha256: ab2a2c00d244974f1a10cfc35e2b164e1ffcfdf6e0b64fe3afa978c2875be7fa

Contents?: true

Size: 1.29 KB

Versions: 7

Compression:

Stored size: 1.29 KB

Contents

var parser = require('../');
var test = require('tap').test;
var path = require('path');

var files = {
    foo: path.join(__dirname, '/files/foo.js'),
    bar: path.join(__dirname, '/files/bar.js')
};

var sources = {
    foo: 'notreal foo',
    bar: 'notreal bar'
};

var cache = {};
cache[files.foo] = {
    source: sources.foo,
    deps: { './bar': files.bar }
};
cache[files.bar] = {
    source: sources.bar,
    deps: {}
};

test('cache preserves expose and entry', function (t) {
    t.plan(1);
    var p = parser({ cache: cache });
    p.write({ id: files.bar, expose: 'bar2', entry: false });
    p.end({ id: 'foo', file: files.foo, entry: true, expose: 'foo2' });
    
    var rows = [];
    p.on('data', function (row) { rows.push(row) });
    p.on('end', function () {
        t.same(rows.sort(cmp), [
            {
                id: 'foo',
                expose: 'foo2',
                entry: true,
                file: files.foo,
                source: sources.foo,
                deps: { './bar': files.bar }
            },
            {
                id: files.bar,
                expose: 'bar2',
                file: files.bar,
                source: sources.bar,
                deps: {}
            }
        ].sort(cmp));
    });
});

function cmp (a, b) { return a.id < b.id ? -1 : 1 }

Version data entries

7 entries across 7 versions & 2 rubygems

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