Permalink
Browse files

Fix remaining errors, add test command

  • Loading branch information...
1 parent 34648fb commit 3178f0dfaa47ff2ea849c47f32fefc8e2106c2d8 @chrisdickinson committed Jun 22, 2011
Showing with 9 additions and 5 deletions.
  1. +3 −0 package.json
  2. +1 −0 test/test.js
  3. +5 −5 trace.js
View
@@ -8,6 +8,9 @@
"type": "git",
"url": "git://github.com/chrisdickinson/tracejs.git"
},
+ "scripts": {
+ "test": "node test/test.js"
+ },
"main": "trace.js",
"engines": {
"node": "0.4.X"
View
@@ -63,3 +63,4 @@ try {
}
}
+console.error('Tests passed');
View
@@ -2,13 +2,13 @@ var fs = require('fs'),
natives = process.binding('natives'),
color = require('ansi-color').set;
-var err_re1 = / at ([^\s]+) \(([\w\d\._\-\/]+):(\d+):(\d+)\)/g,
- err_re2 = / at ([^:]+):(\d+):(\d+)/g;
+var err_re1 = / at ([^\s]+) \(([\w\d\._\-\/]+):(\d+):(\d+)\)/,
+ err_re2 = / at ([^:]+):(\d+):(\d+)/;
var Trace = function(first_line, frames, original_error) {
this.first_line = first_line;
this.frames = frames;
- this.original_error;
+ this.original_error = original_error;
};
Trace.defaults = [2, true, 'red'];
@@ -119,8 +119,8 @@ var trace = function(err) {
match1, match2;
frames = stack.map(function(line) {
- match1 = err_re1(stack);
- match2 = err_re2(stack);
+ match1 = err_re1(line);
+ match2 = err_re2(line);
if(match1) {
return new Frame(match1[1], match1[2], parseInt(match1[3], 10), parseInt(match1[4], 10))

0 comments on commit 3178f0d

Please sign in to comment.