Workiva / Workiva/dependency_validator
Refactor tests to use `checkPackage` directly
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 66
- Forks
- 26
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 7
Description
The workspace tests (see #138) run 11 tests in just 1 second, or about 0.1 sec/test. The existing executable_test.dart tests run 25 tests in 1:40, or about 4 sec/test. That's not prohibitively long, but maybe it can be improved.
Both tests generate directories and files to disk in the same way and run the tool on those files. The main difference is that instead of calling dart run dependency_validator and checking the output, the workspace tests call checkPackage() directly and don't spawn any new processes.
The original tests do more than just check the return value though. They also check the stdout, stderr, and exit code, so they use Process.start. They can probably be rewritten to use checkPackage() directly with a custom logger, and use stream matchers from package:test instead of checking the entire process output.
If this results in tests that run similarly to the workspace tests, that could mean the 25 tests will be complete in about 2.5 seconds -- an over 95% speedup.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with executable_test.dart and compare it with the workspace tests referenced in #138. Trace how the tests currently invoke the tool and check stdout, stderr, and exit code, then review checkPackage() and the package:test stream matchers. Done means the executable tests use the direct entry point, preserve those assertions, and achieve a runtime closer to the workspace tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- testing-qa
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100