Skip to content

Refactor tests to use checkPackage directly #140

@Levi-Lesches

Description

@Levi-Lesches

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions