File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,6 +66,13 @@ func TestMain(m *testing.M) {
6666 os .RemoveAll (filepath .Dir (globalBinaryPath ))
6767 }
6868
69+ // Clean up any action cache files created during tests
70+ // Tests may create .github/aw/actions-lock.json in the pkg/cli directory
71+ actionCacheDir := filepath .Join (wd , ".github" )
72+ if _ , err := os .Stat (actionCacheDir ); err == nil {
73+ _ = os .RemoveAll (actionCacheDir )
74+ }
75+
6976 os .Exit (code )
7077}
7178
Original file line number Diff line number Diff line change 1+ //go:build !integration
2+
3+ package cli
4+
5+ import (
6+ "os"
7+ "path/filepath"
8+ "testing"
9+ )
10+
11+ // TestMain provides setup and teardown for unit tests in the cli package
12+ // Note: Integration tests have their own TestMain in compile_integration_test.go
13+ func TestMain (m * testing.M ) {
14+ // Get current working directory before tests run
15+ wd , err := os .Getwd ()
16+ if err != nil {
17+ panic ("Failed to get current working directory: " + err .Error ())
18+ }
19+
20+ // Run all tests
21+ code := m .Run ()
22+
23+ // Clean up any action cache files created during tests
24+ // Tests may create .github/aw/actions-lock.json in the pkg/cli directory
25+ actionCacheDir := filepath .Join (wd , ".github" )
26+ if _ , err := os .Stat (actionCacheDir ); err == nil {
27+ _ = os .RemoveAll (actionCacheDir )
28+ }
29+
30+ os .Exit (code )
31+ }
You can’t perform that action at this time.
0 commit comments