Skip to content

--dart-define-from-file tests are spread across two unrelated files #134279

@andrewkolos

Description

@andrewkolos

See title.

We have tests related to the --dart-define-from-file option in both build_bundle_test.dart and assemble_test.dart. This option does not function differently under these the flutter build bundle and flutter assemble commands, so it would make more sense to group all of these tests together into flutter_command.dart, where the --dart-define-from-file functionality is implemented.

In addition, there are some things about these tests that we should fix:

  • There are multiple tests that make sure we tool exit when --dart-define-from-file is given a malformed file (e.g. invalid JSON). Their titles don't differentiate themselves from each other, which can be confusing. These tests should either be merged into a single test call or be given better names and be grouped together into a group.
  • Nit: Some tests could have better names. The names state what is under test, but not what the expected result is.
  • There is behavior not under test. Specifically, the case where we are unable to parse an .env file (fun fact, we consider any file that doesn't start with { to be an .env file 🙃).

Lastly, while this is not related to the tests, we probably should change the error message printed when the user provides malformed JSON. Currently, we yell at the user.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: tech-debtTechnical debt, code quality, testing, etc.team-toolOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions