(codeMap, entryId, configContext)
| 28 | } |
| 29 | |
| 30 | function runCodeSplitTest(codeMap, entryId, configContext) { |
| 31 | const exportsMap = Object.create(null); |
| 32 | |
| 33 | const requireFromOutputVia = importer => importee => { |
| 34 | const outputId = path.posix.join(path.posix.dirname(importer), importee); |
| 35 | if (outputId in exportsMap) { |
| 36 | return exportsMap[outputId]; |
| 37 | } |
| 38 | const code = codeMap[outputId]; |
| 39 | return code === undefined |
| 40 | ? require(importee) |
| 41 | : (exportsMap[outputId] = requireWithContext( |
| 42 | code, |
| 43 | { require: requireFromOutputVia(outputId), ...context }, |
| 44 | (exportsMap[outputId] = {}) |
| 45 | )); |
| 46 | }; |
| 47 | |
| 48 | const context = { assert, ...configContext }; |
| 49 | let exports; |
| 50 | try { |
| 51 | exports = requireFromOutputVia(entryId)(entryId); |
| 52 | } catch (error) { |
| 53 | return { error, exports: error.exports }; |
| 54 | } |
| 55 | return { exports }; |
| 56 | } |
| 57 | |
| 58 | runTestSuiteWithSamples( |
| 59 | 'function', |
no test coverage detected
searching dependent graphs…