Skip to content

Commit

Permalink
find-package-json
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Aug 25, 2024
1 parent 57c0016 commit 541958e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as os from "os";
import * as path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
import * as findPackageJson from "find-package-json";
import find from "find-package-json";

const validErrorCombinations = {
error: ["error", "warning", "info"],
Expand Down Expand Up @@ -421,7 +421,7 @@ function getNpmGroovyLintVersion() {
let v = process.env.npm_package_version;
if (!v) {
try {
const finder = findPackageJson(__dirname);
const finder = find(__dirname);
v = finder.next().value.version;
} catch {
v = "error";
Expand Down
4 changes: 2 additions & 2 deletions test/miscellaneous.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as childProcess from "child_process";
import fs from 'fs-extra'
import * as os from "os";
import * as path from "path";
import * as findPackageJson from "find-package-json";
import find from "find-package-json";
import * as util from 'util'
import * as which from 'which'
const exec = util.promisify(childProcess.exec);
Expand Down Expand Up @@ -286,7 +286,7 @@ describe("Miscellaneous", function() {
process.env.npm_package_version = ""; // NV: Do not use npm_package_version to have more code coverage :)
const linter = await new NpmGroovyLint([process.execPath, "", "-v"], {}).run();
assert(linter.status === 0, `Linter status is 0 (${linter.status} returned)`);
const finder = findPackageJson(__dirname);
const finder = find(__dirname);
const v = finder.next().value.version;
assert(linter.outputString.includes(`npm-groovy-lint version ${v}`), `Provides version ${v}\nReturned outputString:\n${linter.outputString}`);
assert(linter.outputString.includes(`CodeNarc version`), `Provides CodeNarc version\nReturned outputString:\n${linter.outputString}`);
Expand Down

0 comments on commit 541958e

Please sign in to comment.