Permalink
Browse files

Glob test filenames so they work on windows

Fix #65
  • Loading branch information...
1 parent 3ff1eef commit 38644f650058d66dbfc12b1dc5c93085450212ed @isaacs isaacs committed Jan 22, 2013
Showing with 26 additions and 4 deletions.
  1. +21 −2 lib/tap-runner.js
  2. +2 −1 package.json
  3. +3 −1 test/segv.js
View
@@ -9,6 +9,7 @@ var fs = require("fs")
, inherits = require("inherits")
, util = require("util")
, CovHtml = require("./tap-cov-html.js")
+ , glob = require("glob")
// XXX Clean up the coverage options
, doCoverage = process.env.TAP_COV
@@ -122,9 +123,27 @@ Runner.prototype.runDir = function (dir, cb) {
}
+// glob the filenames so that test/*.js works on windows
Runner.prototype.runFiles = function (files, dir, cb) {
-
var self = this
+ var globRes = []
+ chain(files.map(function (f) {
+ return function (cb) {
+ glob(f, function (er, files) {
+ if (er)
+ return cb(er)
+ globRes.push.apply(globRes, files)
+ cb()
+ })
+ }
+ }), function (er) {
+ if (er)
+ return cb(er)
+ runFiles(self, globRes, dir, cb)
+ })
+}
+
+function runFiles(self, files, dir, cb) {
chain(files.map(function(f) {
return function (cb) {
if (self._bailedOut) return
@@ -219,7 +238,7 @@ Runner.prototype.runFiles = function (files, dir, cb) {
err += c
})
- cp.on("exit", function (code, signal) {
+ cp.on("close", function (code, signal) {
if (cp._ended) return
cp._ended = true
var ok = !cp._timedOut && code === 0
View
@@ -14,7 +14,8 @@
"mkdirp": "~0.3",
"difflet": "~0.2.0",
"deep-equal": "~0.0.0",
- "buffer-equal": "~0.0.0"
+ "buffer-equal": "~0.0.0",
+ "glob": "~3.1.14"
},
"bundledDependencies": [
"inherits",
View
@@ -31,7 +31,9 @@ test('segv', function (t) {
var r = new Runner({argv:{remain:['./segv']}})
var tc = new TC()
var expect =
- [ { 'id': 1,
+ [ 'TAP version 13'
+ , './segv'
+ , { 'id': 1,
'ok': false,
'name': ' ././segv',
'exit': null,

0 comments on commit 38644f6

Please sign in to comment.