tlrobinson / long-stack-traces

Long stacktraces for V8 implemented in user-land JavaScript. [UNMAINTAINED] Use https://github.com/mattinsler/longjohn instead

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type error in long-stack-traces.js:7

alinex opened this issue · comments

If i require the module in asimple mocha test:

chai = require 'chai'
expect = chai.expect
require 'long-stack-traces'
it "should work", ->
  # do nothin and succeed
  expect(1+1).to.equal 2

The following error will occure:

/home/alex/a3/node-error/node_modules/long-stack-traces/lib/long-stack-traces.js:7
e = new Error().stack.split("\n")[1].match(/^ at ((?:\w+://)?[^:]+)/)[1];
^
TypeError: Cannot read property '1' of null
at /home/alex/a3/node-error/node_modules/long-stack-traces/lib/long-stack-traces.js:7:90
at Object. (/home/alex/a3/node-error/node_modules/long-stack-traces/lib/long-stack-traces.js:265:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (/usr/lib/node_modules/alinex-builder/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/alex/a3/node-error/test/mocha/index.coffee:4:1)
at Object. (/home/alex/a3/node-error/test/mocha/index.coffee:1:1)
at Module._compile (module.js:456:26)
at Object.loadFile (/usr/lib/node_modules/alinex-builder/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
at Module.load (/usr/lib/node_modules/alinex-builder/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /usr/lib/node_modules/alinex-builder/node_modules/mocha/lib/mocha.js:185:27
at Array.forEach (native)
at Mocha.loadFiles (/usr/lib/node_modules/alinex-builder/node_modules/mocha/lib/mocha.js:182:14)
at Mocha.run (/usr/lib/node_modules/alinex-builder/node_modules/mocha/lib/mocha.js:394:31)
at Object. (/usr/lib/node_modules/alinex-builder/node_modules/mocha/bin/_mocha:394:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3

I'm getting the same bug

I think it's related to coffeescript. My coffeescript app has a top-level app.js (in javascript). If I require long-stack-traces after coffeescript, I get the error you describe. If I do it before, no error (though, admittedly, my stack traces are not longer).

require('long-stack-traces')
require('coffee-script/register');