You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your enhancement request related to a problem? Please describe.
In most test runners (builtin or external), there is always a way to filter out tests you want to run. Currently, in Pact, there is no way to run specific test cases such as expect-*, bench, verify, and typecheck forms, or transactions like begin-tx, from a REPL file. Instead, all tests and transactions in the file must be evaluated.
Describe the solution you'd like
We could introduce a command line flag to filter REPL cases/transactions by their labels. For example, with a REPL file like this:
(begin-tx"hello-world")
(load"test.pact")
(expect"should greet the world""Hello, World!" (test.hello-world))
(expect"some other test case""Hello, World!" (test.hello-world))
(commit-tx)
(begin-tx"hello-salama")
(load"test.pact")
(expect"should greet salama""Hello, Salama!" (test.greet"Salama!"))
(commit-tx)
I can run
# Option 1 as an optional positional argument
pact my-module.repl "hello-salama"# will run only the "hello-salama" transaction
pact my-module.repl "hello-world -> should greet the world"# will run only the "should greet the world" test case from the "hello-world" transaction# Option 2 as an optional argument
pact my-module.repl --testName="hello-salama"# will run only the "hello-salama" transaction
pact my-module.repl --testName="hello-world -> should greet the world"# will run only the "should greet the world" test case from the "hello-world" transaction
these are just to demonstrate the idea and ofc you can implement it the way it fits pact /kadena needs as long as it provide the needed functionality
Describe alternatives you've considered
Additional context
I am working on tooling/editor support, and it is really common for those editors to have a UI to run specific tests from a file. I am working on a Zed editor extension, and they have a nice way to run a test by using a tree-sitter query to find where to place the task run button (the play button from the screenshot)
The text was updated successfully, but these errors were encountered:
salamaashoush
changed the title
Add Command Line Flag for Filtering Specific Test Cases and Transactions in Pact REPL Files
Add CLI flag for filtering specific test cases and transactions in pact REPL files
Jun 1, 2024
Is your enhancement request related to a problem? Please describe.
In most test runners (builtin or external), there is always a way to filter out tests you want to run. Currently, in Pact, there is no way to run specific test cases such as
expect-*
,bench
,verify
, andtypecheck
forms, or transactions likebegin-tx
, from a REPL file. Instead, all tests and transactions in the file must be evaluated.Describe the solution you'd like
We could introduce a command line flag to filter REPL cases/transactions by their labels. For example, with a REPL file like this:
I can run
these are just to demonstrate the idea and ofc you can implement it the way it fits pact /kadena needs as long as it provide the needed functionality
Describe alternatives you've considered
Additional context
I am working on tooling/editor support, and it is really common for those editors to have a UI to run specific tests from a file. I am working on a Zed editor extension, and they have a nice way to run a test by using a tree-sitter query to find where to place the task run button (the play button from the screenshot)
The text was updated successfully, but these errors were encountered: