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

browser-run 2.6.0 broken

Open neojski opened this issue 10 years ago • 12 comments

It fails with:

Uncaught SyntaxError: Unexpected token o
SourceMapConsumer @ reporter.js:7159
mapSourcePosition @ reporter.js:8993
wrapCallSite @ reporter.js:9152
(anonymous function) @ reporter.js:9187
prepareStackTrace @ reporter.js:9186
window.onerror @ reporter.js:14

2.5.0 works

neojski avatar Sep 17 '15 01:09 neojski

what browser is that in? can you also post a reproducible testcase?

juliangruber avatar Sep 17 '15 10:09 juliangruber

the new version using electron fixes a lot of issues, this should be gone

juliangruber avatar Oct 30 '15 15:10 juliangruber

Sorry, this still fails for me. I couldn't, however, create the small example because the small one works. Maybe it's some babelification issue. But maybe you'll be able to guess out of this:

    var sourceMap = aSourceMap;
    if (typeof aSourceMap === 'string') {
      sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
    }

This code fragment fails with aSourceMap === 'not supported'. It seems to me like browser-run expects source map and I'm not generating it and it fails to parse the aSourceMap

neojski avatar Oct 31 '15 10:10 neojski

where is this snippet from?

juliangruber avatar Oct 31 '15 10:10 juliangruber

It's from node_modules/browser-run/static/reporter.js.

neojski avatar Oct 31 '15 10:10 neojski

and which browser are you using?

juliangruber avatar Oct 31 '15 11:10 juliangruber

Chrome.

neojski avatar Oct 31 '15 11:10 neojski

hmm, i can't find a way to reproduce unfortunately

juliangruber avatar Oct 31 '15 11:10 juliangruber

I was able to reproduce this in both Chrome and Electron:

  • Write a tape test with a failing assert
  • Bundle the test with webpack/babel
  • Run the test in any browser using tape-run
  • Browser and tape-run both hang

Successful tests work okay. It's only when an assertion fails or a test throws that the problem occurs.

It still seems to be a problem in 3.2.0.

I also get an additional error: Failed to parse SourceMap: http://localhost:64546/FromEventObservable.js.map. This is strange because I don't have source maps turned on in Webpack, and turning them on doesn't seem to help. :confused:

geekytime avatar Aug 05 '16 03:08 geekytime

There seems to be some kind of race condition between tape and something that's getting set up inbrowser-run's reporter.js. If I put a setTimeout around the failing test to make it start a little later, everything works again, and I get the failing result. I can also "fix" it by setting a breakpoint on my failing assert in Chrome, slowing down the test.

Could the tape tests be throwing errors before source-map-support is finished sorting out the overall source map and call stack situation?

geekytime avatar Aug 05 '16 03:08 geekytime

@geekytime great investigate work! can you post what you wrote to test this bug here?

juliangruber avatar Aug 05 '16 14:08 juliangruber

My example was all bound up in my tests for my project, and then I went on vacation. 😄

I can take another look in the next few days, and see if I can whip up a small example project.

geekytime avatar Aug 09 '16 15:08 geekytime