Skip to content

Commit

Permalink
updated cache test, passes
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Feb 20, 2013
1 parent fa42e0b commit 0eaa81e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Empty file modified test/multi_ignore.js 100755 → 100644
Empty file.
25 changes: 13 additions & 12 deletions test/require_cache.js
Expand Up @@ -2,17 +2,18 @@ var vm = require('vm');
var browserify = require('../');
var test = require('tap').test;

test('require.cache', function (t) {
t.plan(3);
test('cached require results', function (t) {
t.plan(1);

var src = browserify().require('seq').bundle();
var c = {};
vm.runInNewContext(src, c);
var seqPath = c.require.resolve('seq');
t.equal(c.require.cache[seqPath], undefined);

var seq = c.require('seq');
t.equal(seq, c.require.cache[seqPath].exports);
var seqCached = c.require('seq'); // check if require() uses the cache
t.equal(seq, seqCached);
var b = browserify();
b.require('seq');
b.bundle(function (err, src) {
var c = {};
vm.runInNewContext(src, c);

var seq0 = c.require('seq');
var seq1 = c.require('seq');

t.ok(seq0 === seq1);
});
});

0 comments on commit 0eaa81e

Please sign in to comment.