onurozgurozkan
`mix test --cover` generates `Inspect.XXX.XXX` modules which repo does not have
Hi folks,
When we run mix test --cover, we see some modules which starts with Inspect.XXX.XXX at cover results.
mix test --cover
Output
Generating cover results ...
Percentage | Module
-----------|--------------------------
0.00% | Inspect.Datalayer.Account
0.00% | Inspect.Datalayer.User
0.00% | Datalayer.Account
0.00% | Datalayer.User
0.00% | Datalayer.Number
- Our system has
Datalayer.Account,Datalayer.User, etc modules but has notInspect.Datalayer.Account,Inspect.Datalayer.Usermodules. - We have more than 20 modules, but only 5 of them generate
Inspect.XXX.XXXmodule when we runmix test --cover. - All these modules has
use Ecto.Schemabehavior.
My questions are
- To understand what is happening here?
- Any suggestion? Should I exclude these modules (Inspect.XXX.XXX) from test? etc.
Regards.
Marked As Solved
awerment
To answer your first question: Inspect is an Elixir protocol that is implemented for some of your schema modules. Most likely because you have redact: true set on some fields. Ecto derives a custom Inspect implementation in that case.
In general: for each protocol Proto that is implemented for a module Mod, there will be an implementation module called Proto.Mod.
As for testing or excluding the modules, maybe somebody else has a recommendation. (I‘m not tracking test coverage in any of my projects) You could write tests that check if the schema fields are redacted when inspected - at that point you’d be testing Ecto itself though ![]()
Also Liked
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









