async function createPolicyForTest(testFn, opts = {}) {
  /** @type {import('./scenario').NormalizedScenarioJSFile[]} */
  const files = [
    {
      type: 'js',
      specifier: './entry.js',
      file: './entry.js',
      packageName: '$root$',
      importMap: {
        test: './node_modules/test/index.js',
      },
      content: 'require("test")',
      entry: true,
    },
    {
      // non-entry
      type: 'js',
      specifier: './node_modules/test/index.js',
      file: './node_modules/test/index.js',
      packageName: 'test',
      importMap: {},
      content: typeof testFn === 'function' ? `(${testFn})()` : `${testFn}`,
    },
  ]
  const policy = await generatePolicyFromFiles({ files, ...opts })
  return policy
}
Create a LavaMoat policy config for a given test function

@param {() => any} testFn - Test function which will be wrapped and used as
  the module contents; otherwise a string of the module contents. ESM modules
  must use a string, since `import` and `export` are only valid at the top
  level.
@param {Partial<GeneratePolicyFromFilesOpts>} [opts]
@returns {Promise<import('../src/schema').LavaMoatPolicy>}