tape-run icon indicating copy to clipboard operation
tape-run copied to clipboard

No source map support?

Open binarykitchen opened this issue 8 years ago • 1 comments

With the browserify command, all gets bundled and in case of an error, it does not point to the correct line number of the source code. Is there a trick to make this happen?

binarykitchen avatar Jun 18 '16 00:06 binarykitchen

Taken back what I've written before;

simple solution is to use source-map-support

you write your test i.e

require('source-map-support').install()

var test = require('tape-catch')

test('virtual dom', function(t) {

  t.plan(1)
  t.equal(1, 2)
  t.end()

})

compile it with browserify in debug mode

browserify test.js --debug | tape-run

process.stdout output will have the source mapping to your files.

TAP version 13                                                                                                                      
# virtual dom                                                                                                                       
not ok 1 should be equal                                                                                                            
  ---                                                                                                                               
    operator: equal                                                                                                                 
    expected: 2                                                                                                                     
    actual:   1                                                                                                                     
    at: Test.assert [as _assert] (/node_modules/tape/lib/test.js:216:1)                                                             
    stack: |-                                                                                                                       
      Error: should be equal                                                                                                        
          at Test.assert [as _assert] (/node_modules/tape/lib/test.js:212:1)                                                        
          at Test.bound [as _assert] (/node_modules/tape/lib/test.js:64:1)                                                          
          at Test.equal.Test.equals.Test.isEqual.Test.is.Test.strictEqual.Test.strictEquals (/node_modules/tape/lib/test.js:347:1)  
          at Test.bound (/node_modules/tape/lib/test.js:64:1)                                                                       
          at Test.<anonymous> (/http:/vdom.js:9:1)                                                                                  
          at Test.bound [as _cb] (/node_modules/tape/lib/test.js:64:1)                                                              
          at Test.exports.Test.run (/node_modules/tape-catch/index.js:26:1)                                                         
          at Test.bound [as run] (/node_modules/tape/lib/test.js:64:1)                                                              
          at next (/node_modules/tape/lib/results.js:71:1)                                                                          
          at Item.run (/http:/C:/Users/SHAHRUL/AppData/Roaming/npm/node_modules/browserify/node_modules/process/browser.js:64:1)    
  ...                                                                                                                               
                                                                                                                                    
1..1                                                                                                                                
# tests 1                                                                                                                           
# pass  0                                                                                                                           
# fail  1                                                                                                                           

syarul avatar Sep 15 '17 04:09 syarul