@@ -12,6 +12,7 @@ import (
1212 "github.com/jfrog/jfrog-client-go/utils/io"
1313 clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests"
1414 "github.com/stretchr/testify/assert"
15+ "github.com/stretchr/testify/require"
1516 "os"
1617 "os/exec"
1718 "path/filepath"
@@ -69,9 +70,7 @@ func TestPackageManagerLoginCommand_Npm(t *testing.T) {
6970 npmLoginCmd .serverDetails .SetAccessToken (testCase .accessToken )
7071
7172 // Run the login command and ensure no errors occur.
72- if ! assert .NoError (t , npmLoginCmd .Run ()) {
73- t .FailNow ()
74- }
73+ require .NoError (t , npmLoginCmd .Run ())
7574
7675 // Read the contents of the temporary npmrc file.
7776 npmrcContentBytes , err := os .ReadFile (npmrcFilePath )
@@ -120,9 +119,7 @@ func TestPackageManagerLoginCommand_Yarn(t *testing.T) {
120119 yarnLoginCmd .serverDetails .SetAccessToken (testCase .accessToken )
121120
122121 // Run the login command and ensure no errors occur.
123- if ! assert .NoError (t , yarnLoginCmd .Run ()) {
124- t .FailNow ()
125- }
122+ require .NoError (t , yarnLoginCmd .Run ())
126123
127124 // Read the contents of the temporary npmrc file.
128125 yarnrcContentBytes , err := os .ReadFile (yarnrcFilePath )
@@ -185,9 +182,7 @@ func testPackageManagerLoginCommandPip(t *testing.T, packageManager project.Proj
185182 pipLoginCmd .serverDetails .SetAccessToken (testCase .accessToken )
186183
187184 // Run the login command and ensure no errors occur.
188- if ! assert .NoError (t , pipLoginCmd .Run ()) {
189- t .FailNow ()
190- }
185+ require .NoError (t , pipLoginCmd .Run ())
191186
192187 // Read the contents of the temporary pip config file.
193188 pipConfigContentBytes , err := os .ReadFile (pipConfFilePath )
@@ -250,9 +245,7 @@ func TestPackageManagerLoginCommand_configurePoetry(t *testing.T) {
250245 poetryLoginCmd .serverDetails .SetAccessToken (testCase .accessToken )
251246
252247 // Run the login command and ensure no errors occur.
253- if ! assert .NoError (t , poetryLoginCmd .Run ()) {
254- t .FailNow ()
255- }
248+ require .NoError (t , poetryLoginCmd .Run ())
256249
257250 // Validate that the repository URL was set correctly in config.toml.
258251 // Read the contents of the temporary Poetry config file.
@@ -304,9 +297,7 @@ func TestPackageManagerLoginCommand_Go(t *testing.T) {
304297 goLoginCmd .serverDetails .SetAccessToken (testCase .accessToken )
305298
306299 // Run the login command and ensure no errors occur.
307- if ! assert .NoError (t , goLoginCmd .Run ()) {
308- t .FailNow ()
309- }
300+ require .NoError (t , goLoginCmd .Run ())
310301
311302 // Get the value of the GOPROXY environment variable.
312303 outputBytes , err := exec .Command ("go" , "env" , "GOPROXY" ).Output ()
@@ -369,9 +360,7 @@ func testBuildToolLoginCommandConfigureDotnetNuget(t *testing.T, packageManager
369360 nugetLoginCmd .serverDetails .SetAccessToken (testCase .accessToken )
370361
371362 // Run the login command and ensure no errors occur.
372- if ! assert .NoError (t , nugetLoginCmd .Run ()) {
373- t .FailNow ()
374- }
363+ require .NoError (t , nugetLoginCmd .Run ())
375364 found := ""
376365 err = filepath .WalkDir (homeDir , func (path string , d os.DirEntry , err error ) error {
377366 if err != nil {
@@ -392,7 +381,9 @@ func testBuildToolLoginCommandConfigureDotnetNuget(t *testing.T, packageManager
392381 // Validate that the repository URL was set correctly in Nuget.config.
393382 // Read the contents of the temporary Poetry config file.
394383 nugetConfigContentBytes , err := os .ReadFile (nugetConfigFilePath )
395- assert .NoError (t , err )
384+ require .NoError (t , err )
385+ assert .FileExists (t , nugetConfigFilePath )
386+
396387 nugetConfigContent := string (nugetConfigContentBytes )
397388
398389 assert .Contains (t , nugetConfigContent , fmt .Sprintf ("add key=\" %s\" value=\" https://acme.jfrog.io/artifactory/api/nuget/v3/test-repo\" " , dotnet .SourceName ))
0 commit comments