Skip to content

Commit

Permalink
[Refactor] move index.js code into lib/
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 29, 2023
1 parent e52bb18 commit 4ed8e77
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions index.js → lib/index.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 5 additions & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
/*
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions test/exit.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ tap.test('too few exit', function (t) {
' operator: fail',
' expected: 6',
' actual: 5',
' at: process.<anonymous> ($TAPE/index.js:$LINE:$COL)',
' at: process.<anonymous> ($TAPE/lib/index.js:$LINE:$COL)',
' stack: |-',
' Error: plan != count',
' [... stack stripped ...]',
Expand Down Expand Up @@ -135,7 +135,7 @@ tap.test('more planned in a second test', function (t) {
' operator: fail',
' expected: 2',
' actual: 1',
' at: process.<anonymous> ($TAPE/index.js:$LINE:$COL)',
' at: process.<anonymous> ($TAPE/lib/index.js:$LINE:$COL)',
' stack: |-',
' Error: plan != count',
' [... stack stripped ...]',
Expand Down Expand Up @@ -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.<anonymous> ($TAPE/index.js:$LINE:$COL)',
' at: process.<anonymous> ($TAPE/lib/index.js:$LINE:$COL)',
' stack: |-',
' Error: test exited without ending: oops forgot end',
' [... stack stripped ...]',
Expand Down

0 comments on commit 4ed8e77

Please sign in to comment.