Skip to content

Conversation

devonestes
Copy link
Contributor

I updated the tests with the new behavior that we're expecting by
excluding tests instead of skipping them. If any of this seems off, let
me know! It makes sense to me, but it's always good to get feedback
before I get too deep in the weeds.

I updated the tests with the new behavior that we're expecting by
excluding tests instead of skipping them. If any of this seems off, let
me know! It makes sense to me, but it's always good to get feedback.
@@ -158,20 +158,20 @@ defmodule ExUnitTest do
assert output =~ "4 tests, 1 failure"

{result, output} = run_with_filter([exclude: [even: true]], [ParityTest])
assert result == %{failures: 0, skipped: 1, total: 4}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add :excluded to the result map.

@josevalim
Copy link
Member

One tiny comment for now: I would add the :excluded key to the map and keep counting them towards total.

Maybe for the initial implementation, can simply replace all skip/skipped by excluded. Then you can introduce the new skipped functionality.

Incorporating José's feedback on the UI for this before implementing
the first step. His (good) recommendation was to first move all
currently "skipped" tests over to being excluded, then re-implement
skipping tests with the `@tag :skip` feature in the new way, so I'm
going to do that.
This introduces the concept of an "excluded" test. This test is usually
excluded at the command line or in some other sort of configuration
option, but is _not_ excluded by using the `:skip` tag.

Right now that functionality to temporarily skip a test is disabled,
but in the coming commits we're going to re-enable that.
@devonestes devonestes force-pushed the differentiate-between-skipped-and-excluded branch from 73d13fc to 9e078d7 Compare January 22, 2018 15:20
We're now making a distinction between tests that are excluded and
skipped. Tests that are skipped are only skipped by using the `@tag
:skipped` tag, whereas there are many way to exclude a test. I've also
re-implemented the printing of a yellow * for skipped tests in the
output, as well as making the `1 skipped` message in the output yellow.
@devonestes devonestes force-pushed the differentiate-between-skipped-and-excluded branch from 9e078d7 to e9e5715 Compare January 22, 2018 15:22
@devonestes devonestes changed the title [WIP] Update tests with new exclude/skipped behavior Update tests with new exclude/skipped behavior Jan 22, 2018
@devonestes
Copy link
Contributor Author

Ok, this is all updated with the addition of a the new concept of an "excluded" test.

Where do you think the best place to document this change is?


def handle_cast({:test_finished, %ExUnit.Test{state: {:skipped, _}} = test}, config) do
if config.trace do
IO.puts(trace_test_skipped(test))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we color this yellow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, totally. I'll update that.

@@ -238,7 +256,8 @@ defmodule ExUnit.CLIFormatter do

message =
"#{test_type_counts}#{config.failure_counter} #{failure_pl}"
|> if_true(config.skipped_counter > 0, &(&1 <> ", #{config.skipped_counter} skipped"))
|> if_true(config.skipped_counter > 0, &(&1 <> ", " <> skipped("#{config.skipped_counter} skipped", config)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think now we can color the whole thing in yellow? As you originally proposed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I never really wanted to color the whole thing yellow, just the 1 skipped part. Do you think the whole thing being yellow is better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with any approach.

@@ -140,7 +140,7 @@ defmodule ExUnit.Runner do

case ExUnit.Filters.eval(include, exclude, tags, tests) do
:ok -> %{test | tags: tags}
{:error, msg} -> %{test | state: {:skip, msg}}
excluded_or_skipped -> %{test | state: excluded_or_skipped}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@josevalim
Copy link
Member

I have added minor comments about style, everything else is perfect!

@josevalim josevalim merged commit 9688cd6 into elixir-lang:master Jan 22, 2018
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants