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

Commit 13dba70

Browse files
authored
Address no-var-requires with loading of package.json (#626)
1 parent 31a18f3 commit 13dba70

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/utils/runCommand.test.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import { WorkspaceManager } from "../../src/services/workspaceManager";
44
import { createConnection } from "vscode-languageserver/node";
55
import { getDoc } from "../helper";
66
import * as path from "path";
7+
import { readFileSync } from "fs";
78

89
describe("commandRunner", () => {
9-
// eslint-disable-next-line @typescript-eslint/no-var-requires
10-
const pkgJSON = require(path.resolve(__dirname, "..", "..", "package.json"));
10+
const packageJsonPath = require.resolve("../../package.json");
11+
const packageJsonContents = readFileSync(packageJsonPath).toString();
12+
const pkgJSON = JSON.parse(packageJsonContents);
1113

1214
const tests = [
1315
{

0 commit comments

Comments
 (0)