Repository: JanDeDobbeleer/oh-my-posh
Pull request #4994 (2024-06-04 03:58:53)

chore: update node LTS versions
### Prerequisites

- [x] I have read and understood the [contributing guide][CONTRIBUTING.md].
- [x] The commit message follows the [conventional commits][cc] guidelines.
- [x] Tests for the changes have been added (for bug fixes / features).
- [x] Docs have been added/updated (for bug fixes / features).

### Description

Updates the Node segment's LTS checking versions for version matching. 

<!---

Tips:

If you're not comfortable with working with Git,
we're working a guide (https://ohmyposh.dev/docs/contributing_git) to help you out.
Oh My Posh advises GitKraken (https://www.gitkraken.com/invite/nQmDPR9D) as your preferred cross platform Git GUI power tool.

-->

[CONTRIBUTING.md]: https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/CONTRIBUTING.md
[cc]: https://www.conventionalcommits.org/en/v1.0.0/#summary



Patch:
diff --git a/src/segments/node.go b/src/segments/node.go
index 78a00402..b0423465 100644
--- a/src/segments/node.go
+++ b/src/segments/node.go
@@ -90,9 +90,9 @@ func (n *Node) matchesVersionFile() (string, bool) {
 		case "gallium":
 			fileVersion = "16.20.2"
 		case "hydrogen":
-			fileVersion = "18.19.1"
+			fileVersion = "18.20.3"
 		case "iron":
-			fileVersion = "20.11.1"
+			fileVersion = "20.14.0"
 		}
 	}
 


Test patch:
diff --git a/src/segments/node_test.go b/src/segments/node_test.go
index b125a27f..a9f6602c 100644
--- a/src/segments/node_test.go
+++ b/src/segments/node_test.go
@@ -11,10 +11,10 @@ import (
 
 func TestNodeMatchesVersionFile(t *testing.T) {
 	nodeVersion := version{
-		Full:  "20.11.1",
+		Full:  "20.14.0",
 		Major: "20",
-		Minor: "11",
-		Patch: "1",
+		Minor: "14",
+		Patch: "0",
 	}
 	cases := []struct {
 		Case            string
@@ -23,16 +23,16 @@ func TestNodeMatchesVersionFile(t *testing.T) {
 		RCVersion       string
 	}{
 		{Case: "no file context", Expected: true, RCVersion: ""},
-		{Case: "version match", Expected: true, ExpectedVersion: "20.11.1", RCVersion: "20.11.1"},
-		{Case: "version match with newline", Expected: true, ExpectedVersion: "20.11.1", RCVersion: "20.11.1\n"},
+		{Case: "version match", Expected: true, ExpectedVersion: "20.14.0", RCVersion: "20.14.0"},
+		{Case: "version match with newline", Expected: true, ExpectedVersion: "20.14.0", RCVersion: "20.14.0\n"},
 		{Case: "version mismatch", Expected: false, ExpectedVersion: "3.2.1", RCVersion: "3.2.1"},
-		{Case: "version match in other format", Expected: true, ExpectedVersion: "20.11.1", RCVersion: "v20.11.1"},
-		{Case: "version match without patch", Expected: true, ExpectedVersion: "20.11", RCVersion: "20.11"},
-		{Case: "version match without patch in other format", Expected: true, ExpectedVersion: "20.11", RCVersion: "v20.11"},
+		{Case: "version match in other format", Expected: true, ExpectedVersion: "20.14.0", RCVersion: "v20.14.0"},
+		{Case: "version match without patch", Expected: true, ExpectedVersion: "20.14", RCVersion: "20.14"},
+		{Case: "version match without patch in other format", Expected: true, ExpectedVersion: "20.14", RCVersion: "v20.14"},
 		{Case: "version match without minor", Expected: true, ExpectedVersion: "20", RCVersion: "20"},
 		{Case: "version match without minor in other format", Expected: true, ExpectedVersion: "20", RCVersion: "v20"},
-		{Case: "lts match", Expected: true, ExpectedVersion: "20.11.1", RCVersion: "lts/iron"},
-		{Case: "lts match upper case", Expected: true, ExpectedVersion: "20.11.1", RCVersion: "lts/Iron"},
+		{Case: "lts match", Expected: true, ExpectedVersion: "20.14.0", RCVersion: "lts/iron"},
+		{Case: "lts match upper case", Expected: true, ExpectedVersion: "20.14.0", RCVersion: "lts/Iron"},
 		{Case: "lts mismatch", Expected: false, ExpectedVersion: "8.17.0", RCVersion: "lts/carbon"},
 	}