removeMatchedModules(matcher) {
    let removed = 0
    const keys = Object.keys(require.cache)
    for (const key of keys) {
      if (matcher.test(key) === false) {
        continue
      }
      delete require.cache[key]
      removed += 1
    }
    return removed
  }
Removes modules from the require cache that are identified by a matcher.

@param {RegExp} matcher

@returns {number} The number of cache entries removed.