| 23 | }); |
| 24 | |
| 25 | async function main({ type }) { |
| 26 | if (type === 'cold') { |
| 27 | bench.start(); |
| 28 | await import(tmpdir.fileURL(`imported-cjs-initial.js`)); |
| 29 | bench.end(1); |
| 30 | } else { |
| 31 | await import(tmpdir.fileURL(`imported-cjs-initial.js`)); // Initialize the wasm first. |
| 32 | bench.start(); |
| 33 | let result; |
| 34 | for (let i = 0; i < runs; i++) { |
| 35 | result = await import(tmpdir.fileURL(`imported-cjs-${i}.js`)); |
| 36 | } |
| 37 | bench.end(runs); |
| 38 | const mod = require(fixtures.path('snapshot', 'typescript.js')); |
| 39 | assert.deepStrictEqual(Object.keys(mod), Object.keys(result.default)); |
| 40 | } |
| 41 | } |