diff --git a/test/common/index.js b/test/common/index.js index 310f0c30dc933b..66ffe3cf9b1c59 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -126,7 +126,9 @@ const isPi = (() => { // the contents of `/sys/firmware/devicetree/base/model` but that doesn't // work inside a container. Match the chipset model number instead. const cpuinfo = fs.readFileSync('/proc/cpuinfo', { encoding: 'utf8' }); - return /^Hardware\s*:\s*(.*)$/im.exec(cpuinfo)?.[1] === 'BCM2835'; + const ok = /^Hardware\s*:\s*(.*)$/im.exec(cpuinfo)?.[1] === 'BCM2835'; + /^/.test(''); // Clear RegExp.$_, some tests expect it to be empty. + return ok; } catch { return false; }