onurozgurozkan

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 not Inspect.Datalayer.Account, Inspect.Datalayer.User modules.
  • We have more than 20 modules, but only 5 of them generate Inspect.XXX.XXX module when we run mix test --cover.
  • All these modules has use Ecto.Schema behavior.

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

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 :man_shrugging:

Also Liked

onurozgurozkan

onurozgurozkan

Dear @awerment,

Thank you for your reply. I really understand what is going on.

Regards.

Where Next?

Popular in Questions Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36432 110
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement