Skip to content

Commit

Permalink
Check tests for warnings (#418)
Browse files Browse the repository at this point in the history
* Check tests for warnings

Code is based on this blog post:
https://dashbit.co/blog/tests-with-warnings-as-errors

* Don't check unused deps on unsupported versions

Also only use `--warnings-as-errors` on 1.11 where it is fully working

* Missed removing the unconditional check-unused
  • Loading branch information
axelson authored Nov 27, 2020
1 parent abb3c48 commit 88ec52e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ script:
echo "Not checking formatting"
fi
- mix test
- |
if [[ "$CHECK_UNUSED_DEPS" -eq 1 ]]
then
mix deps.unlock --check-unused
else
echo "Not checking unused deps"
fi
- |
if [[ "$RUN_DIALYZER" -eq 1 ]]
then
Expand All @@ -32,8 +39,11 @@ matrix:
elixir: 1.9.4
- otp_release: 23.0.4
elixir: 1.10.4
env:
- CHECK_UNUSED_DEPS=1
- otp_release: 23.0.4
elixir: 1.11.1
env:
- CHECK_FORMATTED=1
- RUN_DIALYZER=1
- CHECK_UNUSED_DEPS=1
4 changes: 4 additions & 0 deletions apps/elixir_ls_debugger/test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
if Version.match?(System.version(), ">= 1.11.0") do
Code.put_compiler_option(:warnings_as_errors, true)
end

Application.put_env(:elixir_ls_debugger, :test_mode, true)
ExUnit.start(exclude: [pending: true])
4 changes: 4 additions & 0 deletions apps/elixir_ls_utils/test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
if Version.match?(System.version(), ">= 1.11.0") do
Code.put_compiler_option(:warnings_as_errors, true)
end

ExUnit.start(exclude: [pending: true])
4 changes: 4 additions & 0 deletions apps/language_server/test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if Version.match?(System.version(), ">= 1.11.0") do
Code.put_compiler_option(:warnings_as_errors, true)
end

Application.put_env(:language_server, :test_mode, true)
Application.ensure_started(:stream_data)
ExUnit.start(exclude: [pending: true])

0 comments on commit 88ec52e

Please sign in to comment.