(stack: string, logger: ErrorLogger)
| 313 | ] |
| 314 | |
| 315 | function handleImportOutsideModuleError(stack: string, logger: ErrorLogger) { |
| 316 | if (!esmErrors.some(e => stack.includes(e))) { |
| 317 | return |
| 318 | } |
| 319 | |
| 320 | const path = normalize(stack.split('\n')[0].trim()) |
| 321 | let name = path.split('/node_modules/').pop() || '' |
| 322 | if (name[0] === '@') { |
| 323 | name = name.split('/').slice(0, 2).join('/') |
| 324 | } |
| 325 | else { |
| 326 | name = name.split('/')[0] |
| 327 | } |
| 328 | |
| 329 | if (name) { |
| 330 | printModuleWarningForPackage(logger, path, name) |
| 331 | } |
| 332 | else { |
| 333 | printModuleWarningForSourceCode(logger, path) |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | function printModuleWarningForPackage( |
| 338 | logger: ErrorLogger, |
no test coverage detected