Getting ChromeDriver to utilize source maps in console errors

125 views
Skip to first unread message

Carl Erik Kopseng

unread,
Aug 5, 2019, 11:02:22 AM8/5/19
to Selenium Users
Chrome has been able to use source maps in its error dumps since forever (well, version 39, at least). This means, that instead of having an error print 

https://localhost:56962/bundle.js 94:74996 TypeError: Cannot read property 'map' of undefined

I can get 
./src/redux/employee/employee-reducer.js 20:16 TypeError: Cannot read property 'map' of undefined


This is the case when debugging normally in the browser. When I run our Selenium tests, this does not happen. Instead I get the oh-not-so-useful
09:27:09.540 [main] ERROR gui.rule.ScreenshotRule - Chrome console: SEVERE https://localhost:56962/bundle.js 94:74996 TypeError: Cannot read property 'map' of undefined

Is there a way of instructing ChromeDriver to enable source mapping?

Regards
Carl-Erik

Joe Ward

unread,
Aug 5, 2019, 11:15:06 AM8/5/19
to seleniu...@googlegroups.com
Can you run tests on a version of the app deployed without minification/obfuscation? That’s the only way I’ve achieved it as I don’t think this facility is available. 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/8d545c88-fada-4e78-a0a0-6d261b73a6dc%40googlegroups.com.

Carl Erik Kopseng

unread,
Aug 5, 2019, 4:52:28 PM8/5/19
to Selenium Users
You are right in thinking this feature is unavailable. A guy on the Chromium team verified this in the ChromeDriver group. For now I managed to find a stop gap solution by creating a post-mortem command line tool that can recreate the correct line:col numbers: https://github.com/fatso83/stacktrace-cli

As for running the tests without minification, that is what we do locally. We'd like to test the production build as well, and then you can't really avoid minification.
Reply all
Reply to author
Forward
0 new messages