Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit 435c497

Browse files
authored
Merge pull request #256 from exoego/os
[os] Add OS.version
2 parents 7c6dcd8 + 04a0b87 commit 435c497

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/os/OS.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.scalajs.nodejs.os
22

3+
import com.thoughtworks.enableIf
4+
35
import scala.scalajs.js
46
import scala.scalajs.js.annotation.JSImport
57

@@ -146,6 +148,13 @@ trait OS extends js.Object {
146148
* @return a [[UserInfoObject user information object]]
147149
*/
148150
def userInfo(options: UserInfoOptions = js.native): UserInfoObject = js.native
151+
152+
/**
153+
* Returns a string identifying the kernel version.
154+
* Added in: v13.11.0
155+
*/
156+
@enableIf(io.scalajs.nodejs.internal.CompilerSwitches.gteNodeJs14)
157+
def version(): String = js.native
149158
}
150159

151160
/**
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package io.scalajs.nodejs.os
2+
3+
import org.scalatest.funsuite.AnyFunSuite
4+
5+
class NodeJS14Test extends AnyFunSuite {
6+
test("version") {
7+
assert(OS.version().isInstanceOf[String])
8+
assert(OS.version().nonEmpty)
9+
}
10+
}

0 commit comments

Comments
 (0)