From 35717b7cfc9e53236ab6997809147de56d423d66 Mon Sep 17 00:00:00 2001 From: weiran Date: Tue, 2 Feb 2021 11:18:01 +0800 Subject: [PATCH] Update: eslint --env-info ouput os info --- lib/shared/runtime-info.js | 4 +++- package.json | 1 + tests/lib/shared/runtime-info.js | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/shared/runtime-info.js b/lib/shared/runtime-info.js index 3f16c9152e3..cf3e552f3a0 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 osName = require("os-name"); 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: ${osName()}` ].join("\n"); } diff --git a/package.json b/package.json index 8950b8f6f37..2549fc12756 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", + "os-name": "^4.0.0", "progress": "^2.0.0", "regexpp": "^3.1.0", "semver": "^7.2.1", diff --git a/tests/lib/shared/runtime-info.js b/tests/lib/shared/runtime-info.js index 76ca7c7ca28..5a526ee185d 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"); @@ -57,6 +58,8 @@ describe("RuntimeInfo", () => { let spawnSyncStubArgs; beforeEach(() => { + os.platform = () => "darwin"; + os.release = () => "20.3.0"; spawnSyncStub = sinon.stub(spawn, "sync"); logErrorStub = sinon.stub(log, "error"); originalProcessArgv = process.argv; @@ -109,6 +112,7 @@ describe("RuntimeInfo", () => { npm version: v6.11.3 Local ESLint version: v6.3.0 (Currently used) Global ESLint version: v5.16.0 + Operating System: macOS Big Sur ` ); }); @@ -126,6 +130,7 @@ describe("RuntimeInfo", () => { npm version: v6.11.3 Local ESLint version: v6.3.0 Global ESLint version: v5.16.0 (Currently used) + Operating System: macOS Big Sur ` ); }); @@ -150,6 +155,7 @@ describe("RuntimeInfo", () => { npm version: v6.11.3 Local ESLint version: Not found Global ESLint version: v5.16.0 (Currently used) + Operating System: macOS Big Sur ` ); }); @@ -167,6 +173,7 @@ describe("RuntimeInfo", () => { npm version: v6.11.3 Local ESLint version: v6.3.0 (Currently used) Global ESLint version: Not found + Operating System: macOS Big Sur ` ); });