Skip to content

Commit ffc7b51

Browse files
authored
Fix warnings (#960)
* Fix warning about preferred_cli_env * Update logger config and fix warning * Fix typing violations in client test * Fix warning about fixture files warning: the following files do not match any of the configured `:test_load_filters` / `:test_ignore_filters`: test/fixtures/example-umbrella-app-with-conflict/apps/app_a/lib/module_a.ex test/fixtures/example-umbrella-app-with-conflict/apps/app_b/lib/module_a.ex test/fixtures/example-umbrella-app/apps/app_a/lib/module_a.ex test/fixtures/example-umbrella-app/apps/app_b/lib/module_b.ex This might indicate a typo in a test file name (for example, using "foo_tests.exs" instead of "foo_test.exs"). See the configuration for `:test_pattern` under `mix help test` for more information.
1 parent c282acd commit ffc7b51

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

config/config.exs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,19 @@ if config_env() == :test do
1313
test_mode: true,
1414
traces_sample_rate: 1.0
1515

16-
config :logger, backends: []
16+
if System.version() > "1.16.0" do
17+
config :logger, :default_handler, false
18+
19+
config :sentry, :logger, [
20+
{:handler, :file_log, :logger_std_h,
21+
%{
22+
config: %{file: ~c"log/tests.log"},
23+
formatter: Logger.Formatter.new()
24+
}}
25+
]
26+
else
27+
config :logger, backends: []
28+
end
1729

1830
config :opentelemetry, span_processor: {Sentry.OpenTelemetry.SpanProcessor, []}
1931

mix.exs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ defmodule Sentry.Mixfile do
1414
deps: deps(),
1515
elixirc_paths: elixirc_paths(Mix.env()),
1616
test_paths: test_paths(System.get_env("SENTRY_INTEGRATION")),
17+
test_ignore_filters: [~r|/fixtures/|],
1718
dialyzer: [
1819
flags: [:unmatched_returns, :error_handling, :extra_return],
1920
plt_file: {:no_warn, "plts/dialyzer.plt"},
@@ -22,10 +23,6 @@ defmodule Sentry.Mixfile do
2223
plt_add_apps: [:mix, :ex_unit]
2324
],
2425
test_coverage: [tool: ExCoveralls],
25-
preferred_cli_env: [
26-
"coveralls.html": :test,
27-
"test.integrations": :test
28-
],
2926
name: "Sentry",
3027
docs: [
3128
extra_section: "Guides",
@@ -84,6 +81,10 @@ defmodule Sentry.Mixfile do
8481
]
8582
end
8683

84+
def cli do
85+
[preferred_envs: ["coveralls.html": :test, "test.integrations": :test]]
86+
end
87+
8788
defp extra_applications(:test), do: [:logger, :opentelemetry]
8889
defp extra_applications(_other), do: [:logger]
8990

test/sentry/client_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ defmodule Sentry.ClientTest do
228228
end)
229229

230230
put_test_config(
231-
before_send: fn event ->
231+
before_send: fn %Event{} = event ->
232232
metadata = Map.new(Logger.metadata())
233233
{user_id, rest_metadata} = Map.pop(metadata, :user_id)
234234

235-
%Event{
235+
%{
236236
event
237237
| extra: Map.merge(event.extra, rest_metadata),
238238
user: Map.put(event.user, :id, user_id)

0 commit comments

Comments
 (0)