Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: eslint --env-info output os info #14059

Merged
merged 3 commits into from Mar 20, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 os = require("os");
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: ${os.platform()} ${os.release()}`
].join("\n");
}

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";
Comment on lines +63 to +64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use sinon here to prevent this change from leaking to other tests?

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: darwin 20.3.0
`
);
});
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: darwin 20.3.0
`
);
});
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: darwin 20.3.0
`
);
});
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: darwin 20.3.0
`
);
});
Expand Down