Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix webpacker:compile exit on failure #728

Merged
merged 1 commit into from
Aug 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/webpacker/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def bootstrap
end

def compile
compiler.compile
manifest.refresh
compiler.compile.tap do |success|
manifest.refresh if success
end
end
end
2 changes: 2 additions & 0 deletions lib/webpacker/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def compile
if stale?
record_compilation_digest
run_webpack
else
true
end
end

Expand Down
27 changes: 27 additions & 0 deletions test/command_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require "webpacker_test_helper"

class CommandTest < Minitest::Test
def test_compile_command_returns_success_status_when_stale
Webpacker.compiler.stub :stale?, true do
Webpacker.compiler.stub :run_webpack, true do
assert_equal true, Webpacker.commands.compile
end
end
end

def test_compile_command_returns_success_status_when_fresh
Webpacker.compiler.stub :stale?, false do
Webpacker.compiler.stub :run_webpack, true do
assert_equal true, Webpacker.commands.compile
end
end
end

def test_compile_command_returns_failure_status_when_stale
Webpacker.compiler.stub :stale?, true do
Webpacker.compiler.stub :run_webpack, false do
assert_equal false, Webpacker.commands.compile
end
end
end
end