Skip to content

Commit d7fb7e2

Browse files
davidcavazosiennae
andauthored
fix: testing-isolation do not force run all if no packages were found (#3939)
* fix: testing-isolation do not force run all if no packages were found * add test case --------- Co-authored-by: Jennifer Davis <[email protected]>
1 parent 1504bdc commit d7fb7e2

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.github/cloud-samples-tools/pkg/config/config.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ func (c *Config) Changed(log io.Writer, diffs []string) []string {
177177
changedUnique[pkg] = true
178178
}
179179

180-
if len(changedUnique) == 0 {
181-
return []string{"."}
182-
}
183-
184180
changed := make([]string, 0, len(changedUnique))
185181
for pkg := range changedUnique {
186182
if slices.Contains(c.ExcludePackages, pkg) {

.github/cloud-samples-tools/pkg/config/config_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ func TestChanged(t *testing.T) {
169169
config := c.Config{
170170
PackageFile: []string{"package.json"},
171171
Match: []string{"*"},
172+
Ignore: []string{"ignored.txt"},
172173
ExcludePackages: []string{filepath.Join("testdata", "excluded")},
173174
}
174175

@@ -180,6 +181,10 @@ func TestChanged(t *testing.T) {
180181
diffs: []string{filepath.Join("testdata", "file.txt")},
181182
expected: []string{"."},
182183
},
184+
{ // Ignored files should not trigger tests.
185+
diffs: []string{filepath.Join("testdata", "ignored.txt")},
186+
expected: []string{},
187+
},
183188
{ // Single affected package.
184189
diffs: []string{filepath.Join("testdata", "my-package", "file.txt")},
185190
expected: []string{filepath.Join("testdata", "my-package")},

0 commit comments

Comments
 (0)