tape works nicely in the browser, when browserified. It would be helpful to have some option or advice in the docs how to exclude tape itself from being part of the sourcemap.
Why would you want to exclude it from the sourcemap? Non-inlined source maps aren't downloaded unless you're in the dev tools, and they make stack traces work so well.
I wrote a small test to illustrate the issue that the sourcemap is pointing to "default_stream.js:26", but maybe I am missing something here.
'use strict';
var tape = require('tape');
// this point to test.js:6, which is correct
console.log('this message points to test.js in sourcemap');
// the following all point to default_stream.js:26
// which is inside the tape module
// which is not very usefull
tape('sourcemap pointing to default_stream.js:26', function(t){
t.plan(100);
t.fail('fail');
// stack trace points to the test-bundle.js
// which is not so usefull
t.error(new Error('big error here'), 'an error occured');
t.end();
});
// this point to test.js:22, which is correct
tape('an error', function(t){
throw new Error('a real error points to correct location in sourcemap');
});
See screenshot of the console with file and line number on the right

built with the debug flag browserify test/test.js --debug -o test/test-bundle.js
I was bitten by the same issue.
It looks like the stack trace in tape doesn't account for source maps. Hence when an error is thrown, error lines refer to the compiled file and not the originals.
One should add some code to map the compiled file lines to the originals. In other words reimplement source maps in Test.prototype._assert method.
node-source-map-support seems to solve the problem at least on Chrome.
As you can see from my screenshot, a real Error somehow points to the correct location Unchaught Error: a real error... test.js:22. What bothers me is all the other logs that always point to default_stream.js:26
I am thinking of building tape in a separate file and enable blackbox script, has anyone done that?
The real error is not processed by tape, that's why you can see the right line number.
As for default_stream, you can have a look at the code. All the output is redirected through that console.log (hence the line numbers in the console pointing to default_stream.js:26).
What do you mean with _blackbox script_?
@danielepolencic, node-source-map-support seems to solve the problem at least on Chrome.
Also, it supports in the node.js environment giving proper stack trace.
Most helpful comment
I was bitten by the same issue.
It looks like the stack trace in
tapedoesn't account for source maps. Hence when an error is thrown, error lines refer to the compiled file and not the originals.One should add some code to map the compiled file lines to the originals. In other words reimplement source maps in
Test.prototype._assertmethod.node-source-map-support seems to solve the problem at least on Chrome.