VeryGoodOpenSource / very_good_cli

A Very Good Command-Line Interface for Dart created by Very Good Ventures 🦄

Home Page:http://cli.vgv.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

refactor: include visibleForTesting annotation on test parameters

alestiago opened this issue · comments

Description

Throughout the codebase there are many instances where a class has optional parameters to allow dependency injection during testing, these should be annotated with visibleForTesting.

For example:

// lib/src/commands/create/commands/create_subcommand.dart
  CreateSubCommand({
    required Analytics analytics,
    required this.logger,
    required MasonGeneratorFromBundle? generatorFromBundle,
    required MasonGeneratorFromBrick? generatorFromBrick,
  })

We should intentionally and explicitly denote these as visibleForTesting as:

// lib/src/commands/create/commands/create_subcommand.dart
  CreateSubCommand({
    required Analytics analytics,
    required this.logger,
    @visibleForTesting required MasonGeneratorFromBundle? generatorFromBundle,
    @visibleForTesting required MasonGeneratorFromBrick? generatorFromBrick,
  })

Expected Behavior

  • To have all parameters that are used exclusively for testing purposes be annotated with visibleForTesting.

Additional Context

Hello @alestiago and @BeatriceMitchell,
I hope you're doing well. I'd like to contribute to the very_good_cli and noticed that there's this open issue. Would it be possible to assign this issue to me? I'd be happy to work on it.

Thank you,

Hello @alestiago,
Actually after running the command dart test, some of the tests are failing. So can you please help me out in resolving it?

HI @superiorsd10 , thanks for letting us now! I'm happy to help! Do you mind opening a new issue with the test failure you're getting and information about your system (for example, output of flutter doctor)? This is mainly to avoid polluting this issue and to allow us referencing it if the same problem occurs.

Hello @alestiago,
I've opened an issue regarding this. Please look into it.

some tests are failing on running dart test

Thank you,

@superiorsd10 thanks for opening the issue with all the information! I've now updated the CONTRIBUTING file, if you follow the new steps you should be able to run the test without any failures. Let me know if you run into any other troubles.

@alestiago Sure! Thank you for the help :)

Thank you @alestiago :) The tests are working perfectly fine now.

I've opened another issue, so could you please consider assigning it to me?

fix: markdown formatting mistake in CONTRIBUTING.md file

Thank you,