CherryPoppins

CherryPoppins

Test --cover not changing despite adding test?

I’m having trouble understanding how test --cover is working. I see a module has 0% coverage, add a test for the function defined in that module and test --cover still says 0% for that module. Also, not sure why it is flagging some functions not defined in the module as needing tests. Here is an example of what Im talking about:

here is a screenshot after running test.coverage:

here are the tests for it:

defmodule Core.Tenants.Settings.CheckoutTest do
  @moduledoc false

  use ExUnit.Case, async: true
  alias Core.Tenants.Settings.Checkout

  @valid_attrs %{asset_key: "some string"}
  @invalid_attrs %{}

  test "changeset with valid attributes" do
    changeset = Checkout.changeset(%Checkout{}, @valid_attrs)
    assert changeset.valid?
  end

  test "changeset with invalid attributes" do
    changeset = Checkout.changeset(%Checkout{}, @invalid_attrs)
    refute changeset.valid?
  end

  test "asset_key is required" do
    changeset = Checkout.changeset(%Checkout{}, Map.delete(@valid_attrs, :asset_key))
    refute changeset.valid?
  end
end

Marked As Solved

Sebb

Sebb

This coverage does not make sense.
Which cover-module are you using? I use GitHub - parroty/excoveralls: Coverage report tool for Elixir with coveralls.io integration. - which I can recommend.

Also Liked

CherryPoppins

CherryPoppins

awesome, thanks for all the help!

Where Next?

Popular in Questions Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
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
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
Tee
can someone please explain to me how Enum.reduce works with maps
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
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
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
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
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

We're in Beta

About us Mission Statement