MCPcopy Index your code
hub / github.com/nodejs/node / requireNoPackageJSONAbove

Function requireNoPackageJSONAbove

test/common/index.js:856–868  ·  view source on GitHub ↗
(dir = __dirname)

Source from the content-addressed store, hash-verified

854}
855
856function requireNoPackageJSONAbove(dir = __dirname) {
857 let possiblePackage = path.join(dir, '..', 'package.json');
858 let lastPackage = null;
859 while (possiblePackage !== lastPackage) {
860 if (fs.existsSync(possiblePackage)) {
861 assert.fail(
862 'This test shouldn\'t load properties from a package.json above ' +
863 `its file location. Found package.json at ${possiblePackage}.`);
864 }
865 lastPackage = possiblePackage;
866 possiblePackage = path.join(possiblePackage, '..', '..', 'package.json');
867 }
868}
869
870function spawnPromisified(...args) {
871 const { spawn } = require('child_process');

Callers

nothing calls this directly

Calls 3

joinMethod · 0.45
existsSyncMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…