Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi committed Jun 4, 2024
1 parent 428516d commit 06b0c80
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/decidim/dev/test/rspec_support/webpacker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

RSpec.configure do |config|
config.before(:all) do
raise "Rails.root directory does not exist" unless Rails.root.exist?
raise "package.json file does not exist" unless Rails.root.join("package.json").exist?

Dir.chdir(Rails.root) { Webpacker.compile }
rescue Errno::ENOENT
node_modules_contents = `ls #{Rails.root.join("node_modules")}`

message = <<~ERROR
There was an error during the Webpacker compilation
#{"=" * 80}
Node version: #{`node -v`}
#{"=" * 80}
NPM version: #{`npm -v`}
#{"=" * 80}
Node modules packages: #{`npm list`}
#{"=" * 80}
Node modules contents: #{node_modules_contents}
#{"=" * 80}
ERROR

raise message
end
end

0 comments on commit 06b0c80

Please sign in to comment.