Skip to content

Commit 88ec52e

Browse files
authored
Check tests for warnings (elixir-editors#418)
* 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
1 parent abb3c48 commit 88ec52e

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ script:
99
echo "Not checking formatting"
1010
fi
1111
- mix test
12+
- |
13+
if [[ "$CHECK_UNUSED_DEPS" -eq 1 ]]
14+
then
15+
mix deps.unlock --check-unused
16+
else
17+
echo "Not checking unused deps"
18+
fi
1219
- |
1320
if [[ "$RUN_DIALYZER" -eq 1 ]]
1421
then
@@ -32,8 +39,11 @@ matrix:
3239
elixir: 1.9.4
3340
- otp_release: 23.0.4
3441
elixir: 1.10.4
42+
env:
43+
- CHECK_UNUSED_DEPS=1
3544
- otp_release: 23.0.4
3645
elixir: 1.11.1
3746
env:
3847
- CHECK_FORMATTED=1
3948
- RUN_DIALYZER=1
49+
- CHECK_UNUSED_DEPS=1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
if Version.match?(System.version(), ">= 1.11.0") do
2+
Code.put_compiler_option(:warnings_as_errors, true)
3+
end
4+
15
Application.put_env(:elixir_ls_debugger, :test_mode, true)
26
ExUnit.start(exclude: [pending: true])
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
if Version.match?(System.version(), ">= 1.11.0") do
2+
Code.put_compiler_option(:warnings_as_errors, true)
3+
end
4+
15
ExUnit.start(exclude: [pending: true])
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if Version.match?(System.version(), ">= 1.11.0") do
2+
Code.put_compiler_option(:warnings_as_errors, true)
3+
end
4+
15
Application.put_env(:language_server, :test_mode, true)
26
Application.ensure_started(:stream_data)
37
ExUnit.start(exclude: [pending: true])

0 commit comments

Comments
 (0)