Sha256: ee266539e2de4704555c35ed0ec808f6ff910954864e05bde841b30a5a3da139

Contents?: true

Size: 1.69 KB

Versions: 7

Compression:

Stored size: 1.69 KB

Contents

var sort = require('../');
var test = require('tap').test;
var through = require('through2');

test('dedupe-deps-of-deps', function (t) {
    t.plan(1);
    var s = sort({ dedupe: true });
    var rows = [];
    function write (row, enc, next) { rows.push(row); next() }
    function end () {
        t.deepEqual(rows, [
            {
                id: '/bar.js',
                deps: { baz: '/bar/baz.js' },
                source: 'TWO'
            },
            {
                id: '/bar/baz.js',
                deps: {},
                source: 'THREE'
            },
            {
                id: '/foo.js',
                deps: { baz: '/foo/baz.js' },
                source: 'TWO',
                dedupe: '/bar.js',
                sameDeps: true
            },
            {
                id: '/foo/baz.js',
                deps: {},
                source: 'THREE',
                dedupe: '/bar/baz.js',
                sameDeps: true
            },
            {
                id: '/main.js',
                deps: { './foo': '/foo.js', './bar': '/bar.js' },
                source: 'ONE'
            }
        ]);
    }
    s.pipe(through.obj(write, end));
    
    s.write({
        id: '/main.js',
        deps: { './foo': '/foo.js', './bar': '/bar.js' },
        source: 'ONE'
    });
    s.write({
        id: '/foo.js',
        deps: { baz : '/foo/baz.js' },
        source: 'TWO'
    });
    s.write({
        id: '/bar.js',
        deps: { baz : '/bar/baz.js' },
        source: 'TWO'
    });
    s.write({
        id: '/foo/baz.js',
        deps: {},
        source: 'THREE'
    });
    s.write({
        id: '/bar/baz.js',
        deps: {},
        source: 'THREE'
    });
    s.end();
});

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
minimum_viable_product-0.0.11 test/dummy/node_modules/deps-sort/test/dedupe-deps-of-deps.js
brwy_rails-0.0.6 test/dummy/node_modules/deps-sort/test/dedupe-deps-of-deps.js
brwy_rails-0.0.5 test/dummy/node_modules/deps-sort/test/dedupe-deps-of-deps.js
brwy_rails-0.0.4 test/dummy/node_modules/deps-sort/test/dedupe-deps-of-deps.js
brwy_rails-0.0.3 test/dummy/node_modules/deps-sort/test/dedupe-deps-of-deps.js
brwy_rails-0.0.2 test/dummy/node_modules/deps-sort/test/dedupe-deps-of-deps.js
brwy_rails-0.0.1 test/dummy/node_modules/deps-sort/test/dedupe-deps-of-deps.js