Skip to content

Commit

Permalink
Update: eslint --env-info ouput os info
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Mar 10, 2021
1 parent 0eecad2 commit 35717b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/shared/runtime-info.js
Expand Up @@ -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");

Expand Down Expand Up @@ -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");
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions tests/lib/shared/runtime-info.js
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
`
);
});
Expand All @@ -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
`
);
});
Expand All @@ -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
`
);
});
Expand All @@ -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
`
);
});
Expand Down

0 comments on commit 35717b7

Please sign in to comment.