Skip to content

Conversation

cgcgbcbc
Copy link
Contributor

@cgcgbcbc cgcgbcbc commented May 16, 2016

see #673

  • mini reporter
  • verbose reporter
  • tests

@jamestalmage
Copy link
Contributor

@cgcgbcbc - see avajs/eslint-plugin-ava#110 (comment) for the desired mini reporter format.

Don't worry about figuring out how to gather the issue links. We will figure that out in #836 .

You can ignore the issue links part entirely for this PR if you want. Or you can check for it conditionally.

if (test.issueLinks) {
  test.issueLinks.forEach(...)
}

@cgcgbcbc
Copy link
Contributor Author

You can ignore the issue links part entirely for this PR if you want

I prefer to ignore this part first 😄

} else {
this.passCount++;
if (test.failing) {
this.failCount++;
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean failingCount?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe rename "failing" to knownFailure / knownFailureCount.

@cgcgbcbc
Copy link
Contributor Author

@novemberborn updated.

As for the verbose reporter, it seems that it uses the count in runStatus (which in mini reporter it keeps track by itself). https://github.com/sindresorhus/ava/blob/master/lib/reporters/verbose.js#L74-L81

So when are the count added to runStatus? As perhaps I need to modify that for counting known failure.

@cgcgbcbc
Copy link
Contributor Author

cgcgbcbc commented May 17, 2016

seems that I should just modify run-status? But that would influence a lot others?

@novemberborn
Copy link
Member

seems that I should just modify run-status? But that would influence a lot others?

It'll be fine. You're adding a new property anyhow.

Changes looking good so far @cgcgbcbc!

@jamestalmage
Copy link
Contributor

@cgcgbcbc - We want to land this before cutting a new release. Any chance you can finish this up in the next day or two?

@cgcgbcbc
Copy link
Contributor Author

cgcgbcbc commented May 20, 2016

We want to land this before cutting a new release. Any chance you can finish this up in the next day or two

Ok, I'll try my best to finish this tonight(GMT +8)

}

if (test.failing && !test.error) {
this.knownFailures.push(test);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

where should I write tests for this line? Seems that there is no test/run-status.js

Copy link
Member

Choose a reason for hiding this comment

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

@cgcgbcbc, @nfcampos is running into that as well: #844 (comment).

Maybe leave that for now, focus on the reporter tests (which use stubbed data anyway).

@cgcgbcbc cgcgbcbc changed the title [WIP] add output for failing tests add output for failing tests May 20, 2016
@cgcgbcbc
Copy link
Contributor Author

@novemberborn I've covered the uncovered lines in reporters, but I suppose there must be more tests needed, can you give me some advice?

i++;

var title = test.title;
// var description = JSON.stringify(test);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you forgot to delete this

@cgcgbcbc
Copy link
Contributor Author

It's strange that ci build failed for my last commit which only remove a comment..

};
var actualOutput = reporter.finish(runStatus);
var expectedOutput = [
'\n ' + chalk.green('1 passed') + time,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just remove time. It only prints in watch mode now

@novemberborn
Copy link
Member

See https://gist.github.com/novemberborn/8d0fabc0eefe26e055c8239ff8e26a29 for my test script. I tried it with the mini reporter and --verbose.

@cgcgbcbc
Copy link
Contributor Author

screen shot 2016-05-23 at 15 15 27

screen shot 2016-05-23 at 15 16 22

@novemberborn now the output are like this

@jamestalmage
Copy link
Contributor

I like the red check for the expected failure in verbose mode. Nice touch!


var expectedOutput = ' ' + chalk.red(figures.tick) + ' ' + chalk.red('known failure');

t.is(actualOutput, expectedOutput);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why this assertion failed..
screen shot 2016-05-23 at 15 49 48 1

Copy link
Contributor

Choose a reason for hiding this comment

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

Change the assertion to

t.is(JSON.stringify(actual), JSON.stringify(expected)

Copy link
Contributor

@vadimdemedes vadimdemedes May 23, 2016

Choose a reason for hiding this comment

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

I think colors are the issue here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. My suggestion above will make the color chars visible

Copy link
Contributor

Choose a reason for hiding this comment

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

Did not see your comment when I posted mine ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, fixed now

@jamestalmage
Copy link
Contributor

:shipit:

@sindresorhus
Copy link
Member

LGTM

@sindresorhus sindresorhus merged commit 178175f into avajs:master May 23, 2016
@sindresorhus
Copy link
Member

Really great work on this @cgcgbcbc 👌 Thank you!

@novemberborn
Copy link
Member

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants