Skip to content

Use --verbose when testing CLI output #1477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2017
Merged

Use --verbose when testing CLI output #1477

merged 1 commit into from
Jul 30, 2017

Conversation

novemberborn
Copy link
Member

It cannot be guaranteed that all lines output by the mini reporter are
captured in the stderr of the CLI invocation during testing. Use
--verbose when matching output that the mini reporter may otherwise
rewrite.

Somewhere on at least Node.js 8.2.1, when the package-lock.json is
discarded prior to installation, something in our dependency tree is
different which results in the test title no longer being in the stderr
of the AVA CLI.

Compare:

⠋ ESC[2KESC[1AESC[2KESC[G
⠙ ESC[2KESC[1AESC[2KESC[G
⠹ ESC[2KESC[1AESC[2KESC[G
⠸ ESC[2KESC[1AESC[2KESC[G
⠼ ESC[2KESC[1AESC[2KESC[G
⠴ ESC[2KESC[1AESC[2KESC[G
⠦ ESC[2KESC[1AESC[2KESC[G
⠦ test › works…

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
 1 passed [18:32:54]

Versus:

⠋ ESC[2KESC[1AESC[2KESC[G
⠙ ESC[2KESC[1AESC[2KESC[G
⠹ ESC[2KESC[1AESC[2KESC[G
⠸ ESC[2KESC[1AESC[2KESC[G
⠼ ESC[2KESC[1AESC[2KESC[G
⠴ ESC[2KESC[1AESC[2KESC[G
⠴ …

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
⠦ …

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
 1 passed [18:35:49]

It cannot be guaranteed that all lines output by the mini reporter are
captured in the stderr of the CLI invocation during testing. Use
--verbose when matching output that the mini reporter may otherwise
rewrite.

Somewhere on at least Node.js 8.2.1, when the package-lock.json is
discarded prior to installation, something in our dependency tree is
different which results in the test title no longer being in the stderr
of the AVA CLI.

Compare:

```
⠋ ESC[2KESC[1AESC[2KESC[G
⠙ ESC[2KESC[1AESC[2KESC[G
⠹ ESC[2KESC[1AESC[2KESC[G
⠸ ESC[2KESC[1AESC[2KESC[G
⠼ ESC[2KESC[1AESC[2KESC[G
⠴ ESC[2KESC[1AESC[2KESC[G
⠦ ESC[2KESC[1AESC[2KESC[G
⠦ test › works…

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
 1 passed [18:32:54]
```

Versus:

```
⠋ ESC[2KESC[1AESC[2KESC[G
⠙ ESC[2KESC[1AESC[2KESC[G
⠹ ESC[2KESC[1AESC[2KESC[G
⠸ ESC[2KESC[1AESC[2KESC[G
⠼ ESC[2KESC[1AESC[2KESC[G
⠴ ESC[2KESC[1AESC[2KESC[G
⠴ …

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
⠦ …

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
 1 passed [18:35:49]
```
@novemberborn
Copy link
Member Author

See https://travis-ci.org/avajs/ava/jobs/258140018 for a failing test.

@sindresorhus
Copy link
Member

I guess it's caused by sindresorhus/cli-truncate@f379a0e

@novemberborn
Copy link
Member Author

Maybe. I suppose something removes spurious output that would get rewritten immediately? I don't think it's a problem if the mini reporter doesn't write that to stdout, and it only broke one test.

Not sure if we should explicitly bump any dependencies?

Regardless will merge this to unblock other PRs.

@novemberborn novemberborn merged commit 4eea226 into master Jul 30, 2017
@novemberborn novemberborn deleted the fix-cli-tests branch July 30, 2017 20:15
@sindresorhus
Copy link
Member

Not sure if we should explicitly bump any dependencies?

Nah

kevva pushed a commit that referenced this pull request Sep 13, 2017
It cannot be guaranteed that all lines output by the mini reporter are
captured in the stderr of the CLI invocation during testing. Use
--verbose when matching output that the mini reporter may otherwise
rewrite.

Somewhere on at least Node.js 8.2.1, when the package-lock.json is
discarded prior to installation, something in our dependency tree is
different which results in the test title no longer being in the stderr
of the AVA CLI.

Compare:

```
⠋ ESC[2KESC[1AESC[2KESC[G
⠙ ESC[2KESC[1AESC[2KESC[G
⠹ ESC[2KESC[1AESC[2KESC[G
⠸ ESC[2KESC[1AESC[2KESC[G
⠼ ESC[2KESC[1AESC[2KESC[G
⠴ ESC[2KESC[1AESC[2KESC[G
⠦ ESC[2KESC[1AESC[2KESC[G
⠦ test › works…

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
 1 passed [18:32:54]
```

Versus:

```
⠋ ESC[2KESC[1AESC[2KESC[G
⠙ ESC[2KESC[1AESC[2KESC[G
⠹ ESC[2KESC[1AESC[2KESC[G
⠸ ESC[2KESC[1AESC[2KESC[G
⠼ ESC[2KESC[1AESC[2KESC[G
⠴ ESC[2KESC[1AESC[2KESC[G
⠴ …

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
⠦ …

 1 passedESC[2KESC[1AESC[2KESC[1AESC[2KESC[1AESC[2KESC[G
 1 passed [18:35:49]
```
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.

2 participants