Skip to content

Commit 83e46ba

Browse files
committed
fix: ensure verbose is passed all the way down
1 parent 1357303 commit 83e46ba

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

lib/igniter/util/install.ex

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ defmodule Igniter.Util.Install do
9595
"igniter.install",
9696
yes: force_yes? or "--yes" in argv,
9797
yes_to_deps: force_yes? or "--yes-to-deps" in argv,
98+
verbose: "--verbose" in argv,
9899
only: only,
99100
append?: Keyword.get(opts, :append?, false)
100101
)
@@ -214,9 +215,13 @@ defmodule Igniter.Util.Install do
214215
end
215216

216217
def get_deps!(igniter, opts) do
217-
case Igniter.Util.Loading.with_spinner("fetching deps", fn ->
218-
raising_cmd!("mix", ["deps.get"], stderr_to_stdout: true)
219-
end) do
218+
case Igniter.Util.Loading.with_spinner(
219+
"fetching deps",
220+
fn ->
221+
raising_cmd!("mix", ["deps.get"], stderr_to_stdout: true)
222+
end,
223+
verbose?: opts[:verbose]
224+
) do
220225
{_output, 0} ->
221226
Igniter.Util.Loading.with_spinner(
222227
opts[:operation] || "building deps",
@@ -281,7 +286,8 @@ defmodule Igniter.Util.Install do
281286
ignore_module_conflict: old_ignore_module_conflict
282287
)
283288
end
284-
end
289+
end,
290+
verbose?: opts[:verbose]
285291
)
286292

287293
{output, exit_code} ->

test/mix/tasks/igniter.install_test.exs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ defmodule Mix.Tasks.Igniter.InstallTest do
4848

4949
describe "installing a new project" do
5050
test "basic installer works" do
51+
# get the unsuppressed compilation of `test_project`'s deps out of the way,
52+
# so that the only remaining output is the installer's own
5153
cmd!("mix", ["deps.compile"], cd: "test_project")
5254
output = cmd!("mix", ["igniter.install", "jason"], cd: "test_project")
53-
refute String.contains?(output, "jason\nCompiling")
55+
56+
# each step is reported as a spinner line, with its output suppressed
57+
assert output =~ "fetching deps"
58+
refute output =~ "fetching deps:"
59+
refute output =~ "compiling jason:"
5460
end
5561

5662
test "does not report success when installation is declined" do
@@ -72,8 +78,13 @@ defmodule Mix.Tasks.Igniter.InstallTest do
7278
end
7379

7480
test "displays additional information with `--verbose` option" do
81+
cmd!("mix", ["deps.compile"], cd: "test_project")
7582
output = cmd!("mix", ["igniter.install", "jason", "--verbose"], cd: "test_project")
76-
assert String.contains?(output, "jason\nCompiling")
83+
84+
# each step names itself and passes its output through, rather than spinning
85+
assert output =~ "compile:"
86+
assert output =~ "fetching deps:"
87+
assert output =~ "compiling jason:"
7788
end
7889

7990
test "rerunning the same installer lets you know the dependency was not changed" do

0 commit comments

Comments
 (0)