Permalink
Browse files

Added tests for the windows specific node bug.

  • Loading branch information...
1 parent 9d92d39 commit 9d3b49f854f708df6a770d8ea57f9131c572077d @airportyh airportyh committed Aug 20, 2012
Showing with 56 additions and 0 deletions.
  1. +10 −0 node_bug/failed_spawn.js
  2. +18 −0 node_bug/results.md
  3. +2 −0 node_bug/script.js
  4. +14 −0 node_bug/spawn.js
  5. +12 −0 node_bug/tests.js
View
10 node_bug/failed_spawn.js
@@ -0,0 +1,10 @@
+var spawn = require('child_process').spawn,
+ child = spawn('abc');
+
+child.stderr.setEncoding('utf8');
+child.stderr.on('data', function (data) {
+
+ if (/^execvp\(\)/.test(data)) {
+ console.log('Failed to start child process.');
+ }
+});
View
18 node_bug/results.md
@@ -0,0 +1,18 @@
+On Windows
+----------
+
+ B:\testem\node_bug>node -v
+ v0.8.6
+
+ B:\testem\node_bug>node spawn.js
+
+ B:\testem\node_bug>
+
+On OSX Lion
+-----------
+
+ $ node -v
+ v0.8.6
+ $ node spawn.js
+ hello
+ $
View
2 node_bug/script.js
@@ -0,0 +1,2 @@
+console.log('hello')
+process.exit()
View
14 node_bug/spawn.js
@@ -0,0 +1,14 @@
+var path = require('path')
+var exec = require('child_process').exec
+var spawn = require('child_process').spawn
+var p = exec(path.join('node_modules', '.bin', 'mocha') + ' tests.js -R tap')
+p.stdout.on('data', function(data){
+ process.stdout.write(data + '')
+})
+p.stderr.on('data', function(data){
+ process.stderr.write(data + '')
+})
+p.on('exit', function(){
+ process.exit(0)
+})
+setInterval(function(){}, 1000)
View
12 node_bug/tests.js
@@ -0,0 +1,12 @@
+var assert = require('assert')
+
+function hello(){
+ return 'hello world'
+}
+
+describe('hello', function(){
+ it('should say hello', function(){
+ assert.equal(hello(), 'hello world')
+ })
+})
+

0 comments on commit 9d3b49f

Please sign in to comment.