| 30 | } |
| 31 | |
| 32 | function resolveHelperSource(helper, helperName, config, testsPath) { |
| 33 | const builtin = path.join(helperDir, `${helper.constructor.name}.js`) |
| 34 | if (fs.existsSync(builtin)) return builtin |
| 35 | const requirePath = config?.helpers?.[helperName]?.require |
| 36 | if (requirePath) { |
| 37 | const resolved = path.isAbsolute(requirePath) ? requirePath : path.resolve(testsPath, requirePath) |
| 38 | if (fs.existsSync(resolved)) return resolved |
| 39 | } |
| 40 | return null |
| 41 | } |
| 42 | |
| 43 | function findClassNode(ast) { |
| 44 | for (const node of ast.body) { |