From ece09e253f48416e465a948c0e85ee6d866d7358 Mon Sep 17 00:00:00 2001 From: Christopher Hiller Date: Thu, 4 Jan 2024 11:12:51 -0800 Subject: [PATCH] fix(compartment-mapper): throw if policy/packagePolicy mismatch The logic forbids it, but type inference doesn't necessarily--better to be safe. --- packages/compartment-mapper/src/node-modules.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/compartment-mapper/src/node-modules.js b/packages/compartment-mapper/src/node-modules.js index 9f94eb9d5f..10e497297d 100644 --- a/packages/compartment-mapper/src/node-modules.js +++ b/packages/compartment-mapper/src/node-modules.js @@ -612,6 +612,12 @@ const translateGraph = ( policy, ); + /* c8 ignore next */ + if (policy && !packagePolicy) { + // this should never happen + throw new TypeError('Unexpectedly falsy package policy'); + } + /** * @param {string} dependencyName * @param {string} packageLocation