onflow/cadence-tools

[Test] Add functionality to get available tests in file

Closed this issue · 0 comments

Issue to be solved

A handy feature to have would be something like GetTests which can identify all of the tests in a given file for use in external tools. Specifically, this would be useful for onflow/flow-cli#1273, allowing only the execution of tests matching a pattern/prefix/name.

Even for the "run tests by name" case, the issue is encountered where if using RunTest, a missing test will create an error. The problem with is that the CLI does not know which test file the test is in and will attempt to call RunTest on each file, causing errors, when the user only really wants the test to run from the file which it exists in. Having a utility for the CLI to know which tests are available could ensure that the CLI only runs tests on files which actually contain the test.

Suggested Solution

Add GetTests function