Sha256: 69347aeca754bf98f35722f06aa7cbf51c8c60a679cbbc99594753aca4221ea8

Contents?: true

Size: 936 Bytes

Versions: 3

Compression:

Stored size: 936 Bytes

Contents

var vm = require('vm');
var fs = require('fs');
var browserify = require('../');
var test = require('tap').test;
var crypto = require('crypto');

test('cache', function (t) {
    t.plan(2);
    
    var file = '/tmp/' + Math.floor(Math.random() * (1<<30)).toString(16) + '.json';
    browserify({ cache : file }).require('seq').bundle();
    setTimeout(function () {
        fs.readFile(file, function (err, body) {
            if (err) t.fail(err);
            var cache = JSON.parse(body);
            var tfile = require.resolve('seq');
            fs.readFile(tfile, function (err, body) {
                var hash = new crypto.Hash('md5').update(body).digest('hex');
                t.ok(cache[hash]);
                t.deepEqual(
                    cache[hash].strings.sort(),
                    [ 'events', 'hashish', 'chainsaw' ].sort()
                );
                t.end();
            });
        });
    }, 200);
});

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
snowball-0.1.22 node_modules/browserify/test/cache.js
sprockets-browserify-0.1.2 node_modules/browserify/test/cache.js
sprockets-browserify-0.1.0 node_modules/browserify/test/cache.js