Comments (9)
Hmm, what do you mean: There is no CLI output at all or no summarized output for the entire umbrella project? The latter is what I would expect, since umbrellas simply arrange a common build across a set of projects. Running mix test
or mix compile
for example does not give you a summarized report either (nevertheless that would be nice, but should be handled in mix
first).
from coverex.
Yes. Output of mix test --cover
is:
==> kokon
Cover compiling modules ...
.........
Finished in 0.2 seconds
9 tests, 0 failures
Randomized with seed 376705
Generating cover results ...
==> kokon_web
Cover compiling modules ...
...
Finished in 0.05 seconds
3 tests, 0 failures
Randomized with seed 762656
Generating cover results ...
One app mix.exs
defmodule Kokon.Mixfile do
use Mix.Project
def project do
[app: :kokon,
version: "0.0.1",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
start_permanent: Mix.env == :prod,
test_coverage: [output: "../../cover"],
aliases: aliases(),
deps: deps()]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[mod: {Kokon.Application, []},
extra_applications: [:logger, :runtime_tools]]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[{:postgrex, ">= 0.0.0"},
{:ecto, "~> 2.1"},
{:comeonin, "~> 3.0"},
{:faker, "~> 0.7", only: :test},
{:ex_machina, "~> 2.0", only: :test, runtime: false}]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, to create, migrate and run the seeds file at once:
#
# $ mix ecto.setup
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
["ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
"test": ["ecto.create --quiet", "ecto.migrate", "test"]]
end
end
Second app mix.exs
defmodule Kokon.Web.Mixfile do
use Mix.Project
def project do
[app: :kokon_web,
version: "0.0.1",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
start_permanent: Mix.env == :prod,
test_coverage: [output: "../../cover"],
aliases: aliases(),
deps: deps()]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[mod: {Kokon.Web.Application, []},
extra_applications: [:logger, :runtime_tools]]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[{:phoenix, "~> 1.3.0-rc"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.2"},
{:gettext, "~> 0.11"},
{:kokon, in_umbrella: true},
{:cowboy, "~> 1.0"}]
end
# Aliases are shortcuts or tasks specific to the current project.
# For example, we extend the test task to create and migrate the database.
#
# See the documentation for `Mix` for more info on aliases.
defp aliases do
["test": ["ecto.create --quiet", "ecto.migrate", "test"]]
end
end
Global mix.exs
:
defmodule Kokon.Umbrella.Mixfile do
use Mix.Project
def project do
[apps_path: "apps",
start_permanent: Mix.env == :prod,
dialyzer: [plt_add_deps: :transitive],
test_coverage: [tool: Coverex.Task],
deps: deps()]
end
# Dependencies can be Hex packages:
#
# {:mydep, "~> 0.3.0"}
#
# Or git/path repositories:
#
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
#
# Type "mix help deps" for more examples and options.
#
# Dependencies listed here are available only for this project
# and cannot be accessed from applications inside the apps folder
defp deps do
[{:ex_doc, ">= 0.0.0", only: :dev, runtime: false},
{:credo, ">= 0.0.0", only: :dev, runtime: false},
{:distillery, "~> 1.0", only: :dev, runtime: false},
{:dialyxir, ">= 0.0.0", only: :dev, runtime: false},
{:coverex, "~> 1.4", only: :test, runtime: false},
{:mix_test_watch, "~> 0.3", only: :dev, runtime: false}]
end
end
from coverex.
Won't that overwrite some filenames, like modules.html/functions.html?
from coverex.
@raarts is right:
✓ wc -l apps/*/cover/functions.html | grep total
12184 total
vs.
✓ wc -l cover/functions.html
9530 cover/functions.htm
from coverex.
When umbrella applications depend on another, dependent modules appear in the dependency's report.
Coverage in umbrellas seems to be only sensible when results are merged.
from coverex.
As explained above, coverage in umbrellas works per project, i.e. every project in an umbrella has its own coverage test run and report. Therefore, dependent apps from the umbrella are measures several times, but again consistently as they are required in the project's test run.
What @hauleth proposes does not work, since this will override the results from each test run, i.e. the last run project will win. Providing a global reporting for umbrellas would be nice, but does not exist for compiling and test results either. As @schnittchen points out, (global) coverage reports make only sense if results are merged. But this requires a completely different handling of jobs inside a mix build when running on an umbrella project.
from coverex.
I close this thread, since I will not change the behaviour unless mix itself changes the way of building umbrella projects.
from coverex.
Two notes: maybe it would be prudent to add a note to the README about the bit that coverage in umbrellas works per app, second, I propose the idea of storing output for each app in umbrella-root/cover/<appname>
. Making it easier to publish the entire coverage report as one directory (or save it during across CI stages).
from coverex.
from coverex.
Related Issues (20)
- start httpoision during run HOT 1
- Code not shown as covered HOT 1
- Not working with Poison 1.5 HOT 2
- Error messages "mod_entry is nil and cover = .." HOT 4
- Summary report after test run HOT 4
- Sometimes code is not detected as executed when it did HOT 1
- Module Ignores list HOT 6
- Module.__info__ not covered HOT 4
- Uncovered lines, but no red lines in HTML file HOT 12
- Add support for Codecov HOT 1
- I can't run tests with coverage HOT 3
- Crash in tests with Docker Elixir Image (Elixir 1.3.1 & Erlang 19) HOT 4
- (ArgumentError) argument error - Elixir & Mix 1.3.2 (Erlang/OTP 19). HOT 6
- Nonsensical results when posting to Coveralls via Travis HOT 1
- Split outputters/formatters into separate modules/projects HOT 1
- v1.4.14 on hex.pm broken? HOT 3
- defstruct lines show up as missed
- How to use ignore_modules in an Umbrella APP? HOT 1
- Compiler warnings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coverex.