Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests in the validators folder with file name ending w/ .test.ak, can't be executed with aiken check -m module_name #1092

Closed
3 tasks
nemo83 opened this issue Feb 7, 2025 · 3 comments
Assignees
Labels
tooling Tooling and developer experience improvements

Comments

@nemo83
Copy link

nemo83 commented Feb 7, 2025

What Git revision are you using?

Currently running aiken v1.1.10+b25afa2

What operating system are you using, and which version?

  • Linux / Ubuntu
  • Linux / Other
  • [x ] macOS
  • Windows

Describe what the problem is?

I'm working on a large project https://github.com/cardano-foundation/cardano-ibc-incubator (in the cardano/onchain folder) and this projects contains several validators.

Each validator in the validators folder has a production module and a test module. An example is the spending_transfer_module which has:

When I try to run in isolation the tests for the spending_transfer_module module, with any of the commands:

aiken check -m `spending_transfer_module`
aiken check -m `spending_transfer_module.test`
aiken check -m `spending_transfer_module_test`

the output is empty like it could not find the tests in the module or the test module altogether.

What should be the expected behavior?

Test contained in the validators/spending_transfer_module.test.ak module are run.

@github-project-automation github-project-automation bot moved this to 🪣 Backlog in Project Tracking Feb 7, 2025
@nemo83 nemo83 changed the title Tests in .test.ak files can't be executed with aiken check -m module_name Tests in the validators folder with file name ending w/ .test.ak, can't be executed with aiken check -m module_name Feb 7, 2025
@KtorZ KtorZ moved this from 🪣 Backlog to 🔨 Todo in Project Tracking Feb 8, 2025
@KtorZ KtorZ added the tooling Tooling and developer experience improvements label Feb 8, 2025
@KtorZ KtorZ self-assigned this Feb 8, 2025
@KtorZ
Copy link
Member

KtorZ commented Feb 11, 2025

@nemo83 There's indeed an issue. What is happening is that because the -m option allows you to pass either a test name or a module name, passing only -m spending_transfer_module results in the command looking for a test named spending_transfer_module.

I'll try to come up with a fix, but for now, you can disambiguate the filter for the command by passing:

aiken check -m "spending_transfer_module.{}"

Which makes it parse as a module filter.

@KtorZ
Copy link
Member

KtorZ commented Feb 11, 2025

Okay. So, I didn't fix it in the end, but I opted for better errors and user feedback. Now, test output will come with extra Collecting steps detailing how the filtering options are being interpreted. For example:

command-line optionsoutput
øImage
-m placeholder
Image
-m placeholder.{..}
Image
-m "placeholder.{foo, bar}"
Image

In addition, the case where you specify a module name interpreted as a test scenario is now detected and triggers a warning which suggests the right syntax, like so:

Image

I believe, these additions solve the problem nicely.

@KtorZ KtorZ closed this as completed Feb 11, 2025
@github-project-automation github-project-automation bot moved this from 🔨 Todo to ✅ In Next Release in Project Tracking Feb 11, 2025
KtorZ added a commit that referenced this issue Feb 11, 2025
…ous test filter

Fixes #1092.

Signed-off-by: KtorZ <5680256+KtorZ@users.noreply.github.com>
@rvcas rvcas moved this from ✅ In Next Release to 🚀 Released in Project Tracking Feb 12, 2025
@nemo83
Copy link
Author

nemo83 commented Feb 13, 2025

LGTM, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Tooling and developer experience improvements
Projects
Status: 🚀 Released
Development

No branches or pull requests

2 participants