You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-07-15 01:34:38 +02:00
Added createBOM parameter to the npmExecuteScripts step (#2642)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
84df77732c
commit
cc66b7cabd
@ -1,10 +1,11 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/SAP/jenkins-library/pkg/mock"
|
||||
"github.com/SAP/jenkins-library/pkg/npm"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// NpmMockUtilsBundle for mocking
|
||||
@ -118,4 +119,19 @@ func TestNpmExecuteScripts(t *testing.T) {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Call with createBOM", func(t *testing.T) {
|
||||
config := npmExecuteScriptsOptions{CreateBOM: true, RunScripts: []string{"ci-build", "ci-test"}}
|
||||
|
||||
options := npm.ExecutorOptions{DefaultNpmRegistry: config.DefaultNpmRegistry}
|
||||
|
||||
utils := newNpmMockUtilsBundle()
|
||||
utils.AddFile("package.json", []byte("{\"name\": \"Test\" }"))
|
||||
utils.AddFile("src/package.json", []byte("{\"name\": \"Test\" }"))
|
||||
|
||||
npmExecutor := npm.Execute{Utils: &utils, Options: options}
|
||||
err := runNpmExecuteScripts(&npmExecutor, &config)
|
||||
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user