Change command output instead
This commit is contained in:
parent
acb4eddaca
commit
ebe1e504da
@ -65,7 +65,9 @@ module Homebrew
|
|||||||
formulae: json_info(formulae),
|
formulae: json_info(formulae),
|
||||||
casks: json_info(casks),
|
casks: json_info(casks),
|
||||||
}
|
}
|
||||||
puts JSON.pretty_generate(json)
|
# json v2.8.1 is inconsistent it how it renders empty arrays,
|
||||||
|
# so we use `[]` for consistency:
|
||||||
|
puts JSON.pretty_generate(json).gsub(/\[\n\n\s*\]/, "[]")
|
||||||
|
|
||||||
outdated = formulae + casks
|
outdated = formulae + casks
|
||||||
else
|
else
|
||||||
|
|||||||
@ -20,12 +20,9 @@ RSpec.describe Homebrew::Cmd::Outdated do
|
|||||||
}],
|
}],
|
||||||
casks: [],
|
casks: [],
|
||||||
})
|
})
|
||||||
# json v2.8.1 is inconsistent it how it renders empty arrays,
|
|
||||||
# for now we allow multiple outputs:
|
|
||||||
alternate_json = expected_json.gsub("[]", "[\n\n]")
|
|
||||||
|
|
||||||
expect { brew "outdated", "--json=v2" }
|
expect { brew "outdated", "--json=v2" }
|
||||||
.to output(match(/\A(#{Regexp.escape(expected_json)}|#{Regexp.escape(alternate_json)})\n\z/)).to_stdout
|
.to output("#{expected_json}\n").to_stdout
|
||||||
.and be_a_success
|
.and be_a_success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user