CI: test using cargo-insta

This commit is contained in:
cyqsimon
2023-10-08 01:19:16 +08:00
parent 96cbe63a97
commit 138af25943

View File

@@ -68,6 +68,11 @@ jobs:
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Install cargo-insta
uses: taiki-e/install-action@v2
with:
tool: cargo-insta
- name: Install npcap on Windows
# PRs cannot not be trusted with repository secrets
if: (matrix.os == 'windows-latest') && (github.event_name != 'pull_request')
@@ -79,12 +84,12 @@ jobs:
# see https://stackoverflow.com/a/1674950/5637701
& "$env:TEMP/npcap-oem.exe" /S
- name: Run tests
- name: Run tests using cargo-insta
id: run_tests
# npcap is needed to run tests on Windows, so this is an unfortunate
# sacrifice we have to make in the name of security
if: (matrix.os != 'windows-latest') || (github.event_name != 'pull_request')
run: cargo test --verbose
run: cargo insta test
- name: Upload snapshots of failed tests
if: ${{ failure() && steps.run_tests.outcome == 'failure' }}