Skip to content
Browse files

failing test for require("") bug

  • Loading branch information...
1 parent e9465c3 commit 98539b4a94d24f9238aaef1a03fee49a74f6a871 @substack substack committed Oct 26, 2011
Showing with 34 additions and 0 deletions.
  1. +34 −0 test/bin.js
View
34 test/bin.js
@@ -0,0 +1,34 @@
+var test = require('tap').test;
+var spawn = require('child_process').spawn;
+var vm = require('vm');
+
+test('bin', function (t) {
+ t.plan(3);
+
+ var cwd = process.cwd();
+ process.chdir(__dirname);
+
+ var ps = spawn(__dirname + '/../bin/cli.js', [ 'entry/main.js' ]);
+ var src = '';
+ ps.stdout.on('data', function (buf) {
+ src += buf.toString();
+ });
+
+ ps.on('exit', function (code) {
+ t.equal(code, 0);
+
+ var allDone = false;
+ var c = {
+ done : function () { allDone = true }
+ };
+
+ vm.runInNewContext(src, c);
+ t.deepEqual(
+ [ 'path', '/one.js', '/two.js', '/main.js' ].sort(),
+ Object.keys(c.require.modules).sort()
+ );
+ t.ok(allDone);
+
+ t.end();
+ });
+});

0 comments on commit 98539b4

Please sign in to comment.
Something went wrong with that request. Please try again.