(fileNameOrText: string)
| 2 | import path from "path"; |
| 3 | |
| 4 | export function readFileIfNeed(fileNameOrText: string) { |
| 5 | if (/(\w+\/)*\w+\.(json|txt)/.test(fileNameOrText)) { |
| 6 | const baseDir = path.join(process.cwd(), "__tests__/fixtures"); |
| 7 | const fullPath = path.join(baseDir, fileNameOrText); |
| 8 | return fs.readFileSync(fullPath, "utf8"); |
| 9 | } else { |
| 10 | return fileNameOrText; |
| 11 | } |
| 12 | } |
no outgoing calls
no test coverage detected