Skip to content

Manual rerun doesn't work when verbose mode is off #2458

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

Closed
pcdevil opened this issue Apr 17, 2020 · 5 comments · Fixed by #2470
Closed

Manual rerun doesn't work when verbose mode is off #2458

pcdevil opened this issue Apr 17, 2020 · 5 comments · Fixed by #2470
Labels
bug current functionality does not work as desired help wanted scope:reporters scope:watch-mode

Comments

@pcdevil
Copy link
Contributor

pcdevil commented Apr 17, 2020

Hello,
I'm using AVA with watch mode, and noticed the manual rerun doesn't work if verbose mode is off in the config.

Setup

related package.json part:

{
  /* ... */
  "scripts": {
    "test": "ava --config ava.config.verbose-off.js",
    "test:verbose": "ava --config ava.config.verbose-on.js"
  },
  "devDependencies": {
    "ava": "^3.7.0"
  }
}

ava.config.verbose-off.js:

export default {
        verbose: false,
        watch: true,
}

ava.config.verbose-on.js:

export default {
        verbose: true,
        watch: true,
}

I made a showcase repository to give a quick example of the problem: https://github.com/pcdevil/ava-verbose-test (after cloning, npm install is necessary)

Expected behaviour

When I run the npm run test command the tests can be manually rerun by typing r + <Enter>.

Actual behaviour

The documented feature doesn't triggers AVA to rerun the tests, while using the npm run test:verbose task works properly.

Potential cause

I see AVA uses the MiniReporter and VerboseReporter respectively, and while Watcher.observeStdin() registers callback for the "data" event on stdin, it will never be called somehow when the MiniReporter is used.

Due to the lack of domain knowledge I didn't dig deeper, but I see the two reporters have very similar codebase and I suspect a modification was not applied on both classes which made the MiniReporter behave incorrectly.

The amount of code duplication and the potential cause leads me to believe a targeted refactor would be beneficial to eliminate future discrepancies.
With some guidance from a maintainer I'd happily work on this, but I didn't want to just jump and into and endless pit :)

@novemberborn novemberborn added bug current functionality does not work as desired help wanted scope:reporters scope:watch-mode and removed needs triage labels Apr 18, 2020
@novemberborn
Copy link
Member

Nice find @pcdevil!

Hopefully we can do some more copy/pasting to solve this?

The amount of code duplication and the potential cause leads me to believe a targeted refactor would be beneficial to eliminate future discrepancies.
With some guidance from a maintainer I'd happily work on this, but I didn't want to just jump and into and endless pit :)

That'd be amazing. #2217 summarizes an approach. If it's an incentive, this would help solve many other issues that have bounties on them, see this list: https://github.com/avajs/ava/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Ascope%3Areporters+label%3A%22%3Adollar%3A+Funded+on+Issuehunt%22

@pcdevil
Copy link
Contributor Author

pcdevil commented Apr 21, 2020

@novemberborn thanks for the kind response!

Hopefully we can do some more copy/pasting to solve this?

I'd prefer another approach :)

I see there were interest from others for #2217 - can I consider it is up for grabs for now?
I have some spare time in the upcoming days, I'd create a draft PR for early feedback and see where I can go with it :)

@novemberborn
Copy link
Member

Hopefully we can do some more copy/pasting to solve this?

I'd prefer another approach :)

Sure, but copy/pasting will at least get a fix out sooner.

I see there were interest from others for #2217 - can I consider it is up for grabs for now?
I have some spare time in the upcoming days, I'd create a draft PR for early feedback and see where I can go with it :)

Sounds great. If you comment on that issue I can assign it to you.

@pcdevil
Copy link
Contributor Author

pcdevil commented Apr 22, 2020

Sure, but copy/pasting will at least get a fix out sooner.

I will see how I can handle - I'm just generally against "ohh, I just copy this piece of code and it will be fine" method, but yes, you are right, the sooner fix the better!

Sounds great. If you comment on that issue I can assign it to you.

Done!

I'd separate the work with the two issue to reduce the footprint of the fix itself and presumably make it more rapidly.
Do you agree with this? I'm sensing by your previous comment you do, but want to check.

@novemberborn
Copy link
Member

I'd separate the work with the two issue to reduce the footprint of the fix itself and presumably make it more rapidly.
Do you agree with this? I'm sensing by your previous comment you do, but want to check.

Yea. Rebuilding the reporters is a lot of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired help wanted scope:reporters scope:watch-mode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants