Skip to content

Commit 846fac6

Browse files
committed
Ensure UPDATE_TOOLSNAPS doesn't interfere with tests
1 parent 2765d1d commit 846fac6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/toolsnaps/toolsnaps_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ func TestSnapshotDoesNotExistNotInCI(t *testing.T) {
4343

4444
func TestSnapshotDoesNotExistInCI(t *testing.T) {
4545
withIsolatedWorkingDir(t)
46+
// Ensure that UPDATE_TOOLSNAPS is not set for this test, which it might be if someone is running
47+
// UPDATE_TOOLSNAPS=true go test ./...
48+
t.Setenv("UPDATE_TOOLSNAPS", "false")
4649

4750
// Given we are running in CI
4851
t.Setenv("GITHUB_ACTIONS", "true")
@@ -74,6 +77,9 @@ func TestSnapshotExistsMatch(t *testing.T) {
7477

7578
func TestSnapshotExistsDiff(t *testing.T) {
7679
withIsolatedWorkingDir(t)
80+
// Ensure that UPDATE_TOOLSNAPS is not set for this test, which it might be if someone is running
81+
// UPDATE_TOOLSNAPS=true go test ./...
82+
t.Setenv("UPDATE_TOOLSNAPS", "false")
7783

7884
// Given a non-matching snapshot file exists
7985
require.NoError(t, os.MkdirAll("__toolsnaps__", 0700))
@@ -109,6 +115,9 @@ func TestUpdateToolsnaps(t *testing.T) {
109115

110116
func TestMalformedSnapshotJSON(t *testing.T) {
111117
withIsolatedWorkingDir(t)
118+
// Ensure that UPDATE_TOOLSNAPS is not set for this test, which it might be if someone is running
119+
// UPDATE_TOOLSNAPS=true go test ./...
120+
t.Setenv("UPDATE_TOOLSNAPS", "false")
112121

113122
// Given a malformed snapshot file exists
114123
require.NoError(t, os.MkdirAll("__toolsnaps__", 0700))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy