Last active
October 9, 2020 16:38
-
-
Save danielpowell4/22f1ab6653ffcd7bf6a832a721ea58b7 to your computer and use it in GitHub Desktop.
helpers for debugging webpacker + rails system test for minitest including printing to the console and disabling uglify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://intellipaat.com/community/16534/is-there-a-way-to-print-javascript-console-errors-to-the-terminal-with-rspec-capybara-selenium | |
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase | |
JavaScriptError = Class.new(StandardError) | |
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400] | |
def teardown | |
logs = page.driver.browser.manage.logs.get(:browser) | |
errors = logs.select { |e| e.level == 'SEVERE' && e.message.present? } | |
if errors.present? | |
raise JavaScriptError, errors.map(&:message).join("\n\n") | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.env.NODE_ENV = process.env.NODE_ENV || "development"; | |
const environment = require("./environment"); | |
const config = environment.toWebpackConfig(); | |
// turns off uglify per https://github.com/rails/webpacker/issues/1566 | |
delete config.optimization.minimizer; | |
config.optimization.minimize = false; | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment