mantoni/mochify.js

Newest puppeteer version prints different stack traces, thus breaking builds

Closed this issue · 3 comments

m90 commented

As discussed in #178 the build is currently failing on master and Node 6.

This seems to be due to a change in puppeteer@^1.6 which changed the way stack traces are printed.

The failing test now prints:

# chromium:
1..1
location.href = https://localhost:8080/
not ok 1 url has H1 element
  TypeError: Cannot read property 'textContent' of null
      at Context.<anonymous> (__puppeteer_evaluation_script__:2215:46)
      at callFn (__puppeteer_evaluation_script__:6601:21)
      at Test.Runnable.run (__puppeteer_evaluation_script__:6593:7)
      at Runner.runTest (__puppeteer_evaluation_script__:7088:10)
      at __puppeteer_evaluation_script__:7206:12
      at next (__puppeteer_evaluation_script__:7002:14)
      at __puppeteer_evaluation_script__:7012:7
      at next (__puppeteer_evaluation_script__:6936:14)
      at __puppeteer_evaluation_script__:6980:5
      at timeslice (__puppeteer_evaluation_script__:2417:27)
# tests 1
# pass 0
# fail 1

when we expect:

# chromium:
1..1
location.href = https://localhost:8080/
not ok 1 url has H1 element
TypeError: Cannot read property \'textContent\' of null
    at Context.<anonymous> (test/url.js:11)
# tests 1
# pass 0
# fail 1

Ideally, we'd now remove all the internal puppeteer calls by including it in here:

var IGNORE_RE = /node_modules\/(browserify|browser\-pack|mocha|mocaccino)\//;
but then we'd also lose the initial call site, which is probably a no-go.

The options I see for solving this:

  • live with the puppeteer internals in the stack trace and just change the assertions made in the test to "startsWith/endsWith"
  • add some more intricate logic to trace.js that skips all but the first line if it encounters a __puppeteer_evaluation_script__ block
  • lock puppeteer to ~1.4.0 (probably not)

Any thoughts?

We should make sure the new puppeteer format matches for the replacement regular expression here:

l = l.replace(SOURCE_RE, relativePath);

Ah, no. I got it. The issue is that source-mapper doesn't map it back to the original source properly. Let me try to fix it there.

Build on master is back to green. Stack traces are now properly fixed.