Skip to content

To simplify update of test snapshots generated by the github.com/allaboutapps/go-starter snaphoter

Notifications You must be signed in to change notification settings

anjankow/snapshot-updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Snaphot updater

To simplify update of test snapshots generated by https://github.com/allaboutapps/go-starter/blob/master/internal/test/helper_snapshot.go

How does it work?

Updates all snapshots in a test file or a package. Runs tests with TEST_UPDATE_GOLDEN=true. Then runs the tests again without updating the snapshots.

How to integrate with VS Code?

  1. Clone this repo locally, preferrably within your VS Code Project.

  2. Instal VS Code Command Runner: https://marketplace.visualstudio.com/items?itemName=edonet.vscode-command-runner

  3. Go to Settings and search for Command-Runner:Commands, click on "Edit in settings.json".

Paste the command settings:

"command-runner.commands": {
        "Update file snapshots": "python3 SCRIPT_LOCATION -P ${workspaceFolder} -pkg ${fileDirname} -f ${file}",
        "Update package snapshots": "python3 SCRIPT_LOCATION -P ${workspaceFolder} -pkg ${fileDirname}",
},

Replace SCRIPT_LOCATION with the absolute path of the main.py script.

How to use?

Open any go test file and press Crtl+Shift+R. You will see the list of commands to run. Just select one of them and observe the magic. Congratulations, you saved 5s of your life not doing it manually! 🥳

About

To simplify update of test snapshots generated by the github.com/allaboutapps/go-starter snaphoter

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages