mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-03 15:02:35 +02:00
Add support for yarn (#2721)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
parent
95ebfb3b2f
commit
e4346460ed
@ -129,7 +129,7 @@ func GetArtifact(buildTool, buildDescriptorFilePath string, opts *Options, utils
|
||||
versionField: "version",
|
||||
artifactIDField: "ID",
|
||||
}
|
||||
case "npm":
|
||||
case "npm", "yarn":
|
||||
if len(buildDescriptorFilePath) == 0 {
|
||||
buildDescriptorFilePath = "package.json"
|
||||
}
|
||||
|
@ -118,6 +118,18 @@ func TestGetArtifact(t *testing.T) {
|
||||
assert.Equal(t, "semver2", npm.VersioningScheme())
|
||||
})
|
||||
|
||||
t.Run("yarn", func(t *testing.T) {
|
||||
npm, err := GetArtifact("yarn", "", &Options{VersionField: "theversion"}, nil)
|
||||
|
||||
assert.NoError(t, err)
|
||||
|
||||
theType, ok := npm.(*JSONfile)
|
||||
assert.True(t, ok)
|
||||
assert.Equal(t, "package.json", theType.path)
|
||||
assert.Equal(t, "version", theType.versionField)
|
||||
assert.Equal(t, "semver2", npm.VersioningScheme())
|
||||
})
|
||||
|
||||
t.Run("pip", func(t *testing.T) {
|
||||
fileExists = func(string) (bool, error) { return true, nil }
|
||||
pip, err := GetArtifact("pip", "", &Options{}, nil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user