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

feat(test): allow gno test to default to the current directory #3453

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Nemanya8
Copy link
Contributor

@Nemanya8 Nemanya8 commented Jan 7, 2025

This PR resolves #3420 by enhancing the gno test command.
The command now assumes the current directory (.) as the default path when no directory is specified, aligning its behavior with go test.

Changes to CI:

  • Removed the no_args test.
  • Added new tests to cover the following scenarios:
    • Valid test execution.
    • Valid file-based test.
    • Test with flags.
    • Empty directory.
    • Empty test file.

This PR is a repost of #3429 with a cleaner commit history.

CC @notJoon @moul

@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Jan 7, 2025
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Jan 7, 2025

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details (checked by @thehowl)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 The pull request was created from a fork (head branch repo: Nemanya8/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met
└── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)

Can be checked by

  • team core-contributors

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@notJoon notJoon added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Jan 8, 2025
Copy link
Member

@notJoon notJoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

remove: review/triage flag

@notJoon notJoon removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Jan 9, 2025
@@ -146,10 +146,6 @@ func (c *testCfg) RegisterFlags(fs *flag.FlagSet) {
}

func execTest(cfg *testCfg, args []string, io commands.IO) error {
if len(args) < 1 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make it work by simply putting args as []string{"."} when it's empty? The current approach, verifying paths, looks a bit hacky.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting args as []string{"."} when it's empty works for simple cases like gno test, but it falls apart once you add flags, because args won't be empty anymore.

I also have to check if ./... is in args, since when you run a command with ./... and no matching packages are found, the paths end up with a length of 0. That would incorrectly make it look like there are no path args, which is a false positive.

So while verifying paths might seem a bit clunky, it’s necessary to handle all these edge cases properly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say this and the following test (valid_test) are redundant, I would remove them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed those two tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: In Progress
Status: Triage
4 participants