From 3e81262068eea60e96b2d6c846521d8b8c298d3b Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Tue, 8 Mar 2022 13:32:20 -0700 Subject: [PATCH] fixup! fix(doctor): allow for missing local bin and node_modules --- test/lib/commands/doctor.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/lib/commands/doctor.js b/test/lib/commands/doctor.js index fc69b4f653262..bda6c5f12e023 100644 --- a/test/lib/commands/doctor.js +++ b/test/lib/commands/doctor.js @@ -1,8 +1,9 @@ const t = require('tap') -const { load: loadMockNpm } = require('../../fixtures/mock-npm') -const tnock = require('../../fixtures/tnock.js') const fs = require('fs') +const { load: loadMockNpm } = require('../../fixtures/mock-npm') +const tnock = require('../../fixtures/tnock.js') +const mockGlobals = require('../../fixtures/mock-globals') const { cleanCwd, cleanDate } = require('../../fixtures/clean-snapshot.js') const cleanCacheSha = (str) => @@ -67,12 +68,17 @@ const globals = { version: 'v1.0.0', }, } + // getuid and getgid do not exist in windows, so we shim them // to return 0, as that is the value that lstat will assign the // gid and uid properties for fs.Stats objects if (process.platform === 'win32') { - globals.process.getuid = () => 0 - globals.process.getgid = () => 0 + mockGlobals(t, { + process: { + getuid: () => 0, + getgid: () => 0, + } + }) } const mocks = {