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

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
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
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
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
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
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

Other popular topics Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
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
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement