From f86c09949cbe76034426a99c65b6a2c768c492b1 Mon Sep 17 00:00:00 2001 From: Federico Bozzini Date: Wed, 3 Jun 2020 21:11:23 +0100 Subject: [PATCH] Do not check errors with `instanceof` (#805) This fixes cross-VM type issues in Jest. Backport of https://github.com/isaacs/rimraf/commit/aa50e0298f66b3375045e8d9d86992d696a56b09 --- lib/remove/rimraf.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/remove/rimraf.js b/lib/remove/rimraf.js index 1e44c128..2c771026 100644 --- a/lib/remove/rimraf.js +++ b/lib/remove/rimraf.js @@ -113,9 +113,6 @@ function fixWinEPERM (p, options, er, cb) { assert(p) assert(options) assert(typeof cb === 'function') - if (er) { - assert(er instanceof Error) - } options.chmod(p, 0o666, er2 => { if (er2) { @@ -139,9 +136,6 @@ function fixWinEPERMSync (p, options, er) { assert(p) assert(options) - if (er) { - assert(er instanceof Error) - } try { options.chmodSync(p, 0o666) @@ -173,9 +167,6 @@ function fixWinEPERMSync (p, options, er) { function rmdir (p, options, originalEr, cb) { assert(p) assert(options) - if (originalEr) { - assert(originalEr instanceof Error) - } assert(typeof cb === 'function') // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) @@ -268,9 +259,6 @@ function rimrafSync (p, options) { function rmdirSync (p, options, originalEr) { assert(p) assert(options) - if (originalEr) { - assert(originalEr instanceof Error) - } try { options.rmdirSync(p)