UNPKG

@restqa/restqa

Version:

An all in one test automation runner

17 lines (13 loc) 423 B
const path = require("path"); const fs = require("fs"); function getPackageJson(pathSegment = process.cwd()) { const packageJsonPath = path.resolve(pathSegment, "package.json"); if (typeof packageJsonPath === "string" && fs.existsSync(packageJsonPath)) { const rawPkg = fs.readFileSync(packageJsonPath).toString("utf-8"); return JSON.parse(rawPkg); } return null; } module.exports = { getPackageJson }