diff --git a/lib/shared/runtime-info.js b/lib/shared/runtime-info.js index 3f16c9152e3..aa5eff756a8 100644 --- a/lib/shared/runtime-info.js +++ b/lib/shared/runtime-info.js @@ -11,6 +11,7 @@ const path = require("path"); const spawn = require("cross-spawn"); +const os = require("os"); const log = require("../shared/logging"); const packageJson = require("../../package.json"); @@ -140,7 +141,8 @@ function environment() { `Node version: ${getBinVersion("node")}`, `npm version: ${getBinVersion("npm")}`, `Local ESLint version: ${getNpmPackageVersion("eslint", { global: false })}`, - `Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}` + `Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}`, + `Operating System: ${os.platform()} ${os.release()}` ].join("\n"); } diff --git a/tests/lib/shared/runtime-info.js b/tests/lib/shared/runtime-info.js index 76ca7c7ca28..efe57bb0baa 100644 --- a/tests/lib/shared/runtime-info.js +++ b/tests/lib/shared/runtime-info.js @@ -12,6 +12,7 @@ const assert = require("chai").assert; const sinon = require("sinon"); const spawn = require("cross-spawn"); +const os = require("os"); const { unIndent } = require("../../_utils"); const RuntimeInfo = require("../../../lib/shared/runtime-info"); const log = require("../../../lib/shared/logging"); @@ -55,8 +56,12 @@ describe("RuntimeInfo", () => { let logErrorStub; let originalProcessArgv; let spawnSyncStubArgs; + const originalOsPlatform = os.platform; + const originalOsRelease = os.release; beforeEach(() => { + os.platform = () => "darwin"; + os.release = () => "20.3.0"; spawnSyncStub = sinon.stub(spawn, "sync"); logErrorStub = sinon.stub(log, "error"); originalProcessArgv = process.argv; @@ -94,6 +99,8 @@ describe("RuntimeInfo", () => { spawnSyncStub.restore(); logErrorStub.restore(); process.argv = originalProcessArgv; + os.platform = originalOsPlatform; + os.release = originalOsRelease; }); @@ -109,6 +116,7 @@ describe("RuntimeInfo", () => { npm version: v6.11.3 Local ESLint version: v6.3.0 (Currently used) Global ESLint version: v5.16.0 + Operating System: darwin 20.3.0 ` ); }); @@ -126,6 +134,7 @@ describe("RuntimeInfo", () => { npm version: v6.11.3 Local ESLint version: v6.3.0 Global ESLint version: v5.16.0 (Currently used) + Operating System: darwin 20.3.0 ` ); }); @@ -150,6 +159,7 @@ describe("RuntimeInfo", () => { npm version: v6.11.3 Local ESLint version: Not found Global ESLint version: v5.16.0 (Currently used) + Operating System: darwin 20.3.0 ` ); }); @@ -167,6 +177,7 @@ describe("RuntimeInfo", () => { npm version: v6.11.3 Local ESLint version: v6.3.0 (Currently used) Global ESLint version: Not found + Operating System: darwin 20.3.0 ` ); });