(from: string, moduleName: string)
| 136 | // respective subDir{1,2} directories and expects a manual mock |
| 137 | // corresponding to that particular my_module.js file. |
| 138 | findManualMock(from: string, moduleName: string): string | null { |
| 139 | // Normalize core specifiers (`node:fs` → `fs`) before building the cache |
| 140 | // key so the two forms share an entry instead of populating two. |
| 141 | const canonicalName = this.isCoreModule(moduleName) |
| 142 | ? this.normalizeCoreModuleSpecifier(moduleName) |
| 143 | : moduleName; |
| 144 | const cacheKey = `${from}\0${canonicalName}`; |
| 145 | let result = this.manualMockCache.get(cacheKey); |
| 146 | if (result === undefined) { |
| 147 | result = this.computeManualMock(from, canonicalName); |
| 148 | this.manualMockCache.set(cacheKey, result); |
| 149 | } |
| 150 | return result; |
| 151 | } |
| 152 | |
| 153 | private computeManualMock(from: string, moduleName: string): string | null { |
| 154 | if (this.isCoreModule(moduleName)) { |
no test coverage detected