The agony of parallel file structure

I had a problem today, and what is the best way to solve a problem? Write code that you will forget after a week.

Written by

Tadas

Robert Brunhage

It’s my birthday today, so what is better than to write a story about my agony.

I write a lot of code specifically in Flutter projects. The typical structure includes a lib folder and a test folder with matching folder structures.

The problem

The problem with keeping test files in sync…

  1. You have a lib/ file with the following path: lib/src/utils/strings.dart and a matching test file in test/src/utils/strings_test.dart.
  2. You now move the lib/ file from lib/src/utils/strings.dart to lib/src/strings.dart.
  3. You now have a test file that is not matching the lib file structure anymore.

The solution

I made a good old script in Dart that would sync the structure of the lib folder to the test folder.

Open source, use it or don’t. I don’t care. I just want you to know that I hate test files, but sometimes I don’t.

the project you can upvote, fork and love

Visit the project:

misc