diff --git a/index.js b/lib/index.js similarity index 97% rename from index.js rename to lib/index.js index 8076e4c9..43d28a1d 100644 --- a/index.js +++ b/lib/index.js @@ -1,9 +1,9 @@ 'use strict'; var defined = require('defined'); -var createDefaultStream = require('./lib/default_stream'); -var Test = require('./lib/test'); -var Results = require('./lib/results'); +var createDefaultStream = require('./default_stream'); +var Test = require('./test'); +var Results = require('./results'); var through = require('@ljharb/through'); var canEmitExit = typeof process !== 'undefined' && process diff --git a/lib/test.js b/lib/test.js index 33c7241b..13a59450 100644 --- a/lib/test.js +++ b/lib/test.js @@ -496,6 +496,7 @@ Test.prototype._assert = function assert(ok, opts) { var e = new Error('exception'); var err = $split(e.stack || '', '\n'); var tapeDir = __dirname + path.sep; + var index = path.sep + 'index.js'; for (var i = 0; i < err.length; i++) { /* @@ -558,7 +559,10 @@ Test.prototype._assert = function assert(ok, opts) { '' ); - if ($strSlice(filePath, 0, tapeDir.length) === tapeDir) { + if ( + $strSlice(filePath, 0, tapeDir.length) === tapeDir + && $strSlice(filePath, -index.length) !== index // index.js is inside lib/ + ) { continue; } diff --git a/test/exit.js b/test/exit.js index 8ed986ad..5afc3dab 100644 --- a/test/exit.js +++ b/test/exit.js @@ -98,7 +98,7 @@ tap.test('too few exit', function (t) { ' operator: fail', ' expected: 6', ' actual: 5', - ' at: process. ($TAPE/index.js:$LINE:$COL)', + ' at: process. ($TAPE/lib/index.js:$LINE:$COL)', ' stack: |-', ' Error: plan != count', ' [... stack stripped ...]', @@ -135,7 +135,7 @@ tap.test('more planned in a second test', function (t) { ' operator: fail', ' expected: 2', ' actual: 1', - ' at: process. ($TAPE/index.js:$LINE:$COL)', + ' at: process. ($TAPE/lib/index.js:$LINE:$COL)', ' stack: |-', ' Error: plan != count', ' [... stack stripped ...]', @@ -228,7 +228,7 @@ tap.test('forgot to call t.end()', function (t) { 'not ok 3 test exited without ending: oops forgot end', ' ---', ' operator: fail', - ' at: process. ($TAPE/index.js:$LINE:$COL)', + ' at: process. ($TAPE/lib/index.js:$LINE:$COL)', ' stack: |-', ' Error: test exited without ending: oops forgot end', ' [... stack stripped ...]',