fix(node): stop when yarn is detected

This commit is contained in:
Jan De Dobbeleer 2021-04-18 07:16:38 +02:00 committed by Jan De Dobbeleer
parent 016d981baa
commit 1f25cd4b1c
2 changed files with 2 additions and 0 deletions

View file

@ -49,6 +49,7 @@ func (n *node) loadContext() {
}
if n.language.env.hasFiles("yarn.lock") {
n.packageManagerIcon = n.language.props.getString(YarnIcon, " \uF61A")
return
}
if n.language.env.hasFiles("package-lock.json") || n.language.env.hasFiles("package.json") {
n.packageManagerIcon = n.language.props.getString(NPMIcon, " \uE71E")

View file

@ -49,6 +49,7 @@ func TestNodeInContext(t *testing.T) {
{Case: "npm", hasNPM: true, ExpectedString: "npm", PkgMgrEnabled: true},
{Case: "default", hasDefault: true, ExpectedString: "npm", PkgMgrEnabled: true},
{Case: "disabled", HasYarn: true, ExpectedString: "", PkgMgrEnabled: false},
{Case: "yarn and npm", HasYarn: true, hasNPM: true, ExpectedString: "yarn", PkgMgrEnabled: true},
}
for _, tc := range cases {