Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 1.21 KB

README.md

File metadata and controls

31 lines (24 loc) · 1.21 KB

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! 🥳