Workiva / Workiva/dependency_validator

Refactor tests to use `checkPackage` directly

Open
#140 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.