Permalink
Browse files

Test for a sane stack trace

  • Loading branch information...
joelplane committed Jun 12, 2011
1 parent d84aa58 commit 019d281d79938bbb20ac2759b999c1500abf7ce9
Showing with 22 additions and 0 deletions.
  1. +22 −0 noodleTestTest.js
View
@@ -1,5 +1,6 @@
var test = require('./noodleTest')();
var EventEmitter = require('events').EventEmitter;
+var sys = require('sys');
test.onFailureExitNonZero();
test.context("NoodleTest dogfood test", function() {
@@ -98,4 +99,25 @@ test.context("NoodleTest dogfood test", function() {
});
+ this.context('stack trace', function() {
+ this.it("should be trimmed such that the first line is the client code", function(done) {
+ var myThis = this;
+
+ var t = require('./noodleTest')({quiet: true});
+ t.context('test context', function() {
+ this.it('test test', function(done2){
+ this.assert(false);
+
+ var firstStackLine = this.failures[0].stack[0];
+ // client's test function will be called "testFunction" in the stack trace
+ myThis.assert(firstStackLine.indexOf('.testFunction'));
+
+ done2();
+ done();
+ });
+ });
+
+ });
+ });
+
});

0 comments on commit 019d281

Please sign in to comment.