Skip to content

Instantly share code, notes, and snippets.

@danielpowell4
Last active October 9, 2020 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielpowell4/22f1ab6653ffcd7bf6a832a721ea58b7 to your computer and use it in GitHub Desktop.
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
# 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
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