({ n, type, filename })
| 14 | }); |
| 15 | |
| 16 | function main({ n, type, filename }) { |
| 17 | const scriptPath = path.resolve(__dirname, '..', '..', filename); |
| 18 | const scriptSource = fs.readFileSync(scriptPath, 'utf8'); |
| 19 | let script; |
| 20 | bench.start(); |
| 21 | const options = {}; |
| 22 | switch (type) { |
| 23 | case 'with-dynamic-import-callback': |
| 24 | // Use a dummy callback for now until we really need to benchmark it. |
| 25 | options.importModuleDynamically = async () => {}; |
| 26 | break; |
| 27 | case 'without-dynamic-import-callback': |
| 28 | break; |
| 29 | } |
| 30 | for (let i = 0; i < n; i++) { |
| 31 | script = new vm.Script(scriptSource, options); |
| 32 | } |
| 33 | bench.end(n); |
| 34 | script.runInThisContext(); |
| 35 | } |
nothing calls this directly
no test coverage detected