Skip to content

Commit

Permalink
test: clean and sort snapshots (#904)
Browse files Browse the repository at this point in the history
While doing #902 I realised we've got a couple of packages using
snapshots but not cleaning them up afterwards - this changes that; I've
also opened #903 adding a script to check all packages using snapshots
are cleaning them.
  • Loading branch information
G-Rath authored Apr 9, 2024
1 parent ca67f63 commit b5a88ea
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 48 deletions.
16 changes: 16 additions & 0 deletions internal/image/testmain_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package image_test

import (
"os"
"testing"

"github.com/google/osv-scanner/internal/testutility"
)

func TestMain(m *testing.M) {
code := m.Run()

testutility.CleanSnapshots(m)

os.Exit(code)
}
96 changes: 48 additions & 48 deletions internal/resolution/datasource/__snapshots__/npmrc_test.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@

[TestNpmrcNoRegistries - 1]
https://registry.npmjs.org/@test%2Fpackage/1.2.3
---

[TestNpmrcNoRegistries - 2]
null
---

[TestNpmrcRegistryAuth - 1]
https://registry1.test.com/foo
---

[TestNpmrcRegistryAuth - 2]
[
"Basic bXVjaDphdXRoCg=="
]
---

[TestNpmrcRegistryAuth - 3]
https://registry1.test.com/@test0%2Fbar
---

[TestNpmrcRegistryAuth - 4]
[
"Basic bXVjaDphdXRoCg=="
]
---

[TestNpmrcRegistryAuth - 5]
https://registry2.test.com/@test1%2Fbaz
---

[TestNpmrcRegistryAuth - 6]
[
"Bearer c3VjaCB0b2tlbgo="
]
---

[TestNpmrcRegistryAuth - 7]
https://sub.registry2.test.com/@test2%2Ftest
---

[TestNpmrcRegistryAuth - 8]
[
"Basic dXNlcjp3b3cK"
]
---

[TestNpmrcRegistryOverriding - 1]
https://global.registry.com/pkg
---
Expand Down Expand Up @@ -158,51 +206,3 @@ https://project.registry.com/@project%2Fpkg
[TestNpmrcRegistryOverriding - 40]
null
---

[TestNpmrcRegistryAuth - 1]
https://registry1.test.com/foo
---

[TestNpmrcRegistryAuth - 2]
[
"Basic bXVjaDphdXRoCg=="
]
---

[TestNpmrcRegistryAuth - 3]
https://registry1.test.com/@test0%2Fbar
---

[TestNpmrcRegistryAuth - 4]
[
"Basic bXVjaDphdXRoCg=="
]
---

[TestNpmrcRegistryAuth - 5]
https://registry2.test.com/@test1%2Fbaz
---

[TestNpmrcRegistryAuth - 6]
[
"Bearer c3VjaCB0b2tlbgo="
]
---

[TestNpmrcRegistryAuth - 7]
https://sub.registry2.test.com/@test2%2Ftest
---

[TestNpmrcRegistryAuth - 8]
[
"Basic dXNlcjp3b3cK"
]
---

[TestNpmrcNoRegistries - 1]
https://registry.npmjs.org/@test%2Fpackage/1.2.3
---

[TestNpmrcNoRegistries - 2]
null
---
16 changes: 16 additions & 0 deletions internal/resolution/datasource/testmain_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package datasource_test

import (
"os"
"testing"

"github.com/google/osv-scanner/internal/testutility"
)

func TestMain(m *testing.M) {
code := m.Run()

testutility.CleanSnapshots(m)

os.Exit(code)
}
16 changes: 16 additions & 0 deletions internal/resolution/lockfile/testmain_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package lockfile_test

import (
"os"
"testing"

"github.com/google/osv-scanner/internal/testutility"
)

func TestMain(m *testing.M) {
code := m.Run()

testutility.CleanSnapshots(m)

os.Exit(code)
}
16 changes: 16 additions & 0 deletions internal/resolution/manifest/testmain_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package manifest_test

import (
"os"
"testing"

"github.com/google/osv-scanner/internal/testutility"
)

func TestMain(m *testing.M) {
code := m.Run()

testutility.CleanSnapshots(m)

os.Exit(code)
}

0 comments on commit b5a88ea

Please sign in to comment.