Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Is there a possibility to run Verify checks in CI without file creation? Memorize received output and check with existing verified file contents? #1374

Closed
blazkovicz opened this issue Dec 19, 2024 · 3 comments

Comments

@blazkovicz
Copy link

blazkovicz commented Dec 19, 2024

I did not find any correlating documentation on the matter. Please help!

We use C#, MSTest, Verify.MSTest

@SimonCropp
Copy link
Member

sorry. i don’t understand what u r asking for

@blazkovicz
Copy link
Author

blazkovicz commented Dec 19, 2024

hi! Thanks for quick reaction! I created tests in my net project, using Verify.MSTest nuget package. İt creates .received files and checks against .verified files, all good. When we run tests in jenkins Cİ we don’t want any file creation there, just want actual snapshot contents to be checked on-the-fly against existing .verified file contents and to either succeed or fail with error. How to achieve that?

@SimonCropp
Copy link
Member

enable AutoVerify on the build server:

    public static class ModuleInitializer
    {
        [ModuleInitializer]
        public static void Init()
        {
            if (BuildServerDetector.Detected)
            {
                VerifierSettings.AutoVerify();
            }
        }
    }

then u can run a script to push any changes back. here is how u woud do it in a github action

    - name: Push changes
      run: |
        git config --local user.email "action@github.com"
        git config --local user.name "GitHub Action"
        git commit -m "changes" -a || echo "nothing to commit"
        remote="https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git"
        branch="${GITHUB_REF:11}"
        git push "${remote}" ${branch} || echo "nothing to push"
      shell: bash

@VerifyTests VerifyTests locked and limited conversation to collaborators Dec 20, 2024
@SimonCropp SimonCropp converted this issue into discussion #1375 Dec 20, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Development

No branches or pull requests

2 participants