(reporters, destinations)
| 198 | } |
| 199 | |
| 200 | async function getReportersMap(reporters, destinations) { |
| 201 | return SafePromiseAllReturnArrayLike(reporters, async (name, i) => { |
| 202 | const destination = kBuiltinDestinations.get(destinations[i]) ?? |
| 203 | createWriteStream(destinations[i], { __proto__: null, flush: true }); |
| 204 | |
| 205 | // Load the test reporter passed to --test-reporter |
| 206 | let reporter = tryBuiltinReporter(name); |
| 207 | |
| 208 | if (reporter === undefined) { |
| 209 | let parentURL; |
| 210 | |
| 211 | try { |
| 212 | parentURL = pathToFileURL(process.cwd() + '/').href; |
| 213 | } catch { |
| 214 | parentURL = 'file:///'; |
| 215 | } |
| 216 | |
| 217 | const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader(); |
| 218 | reporter = await cascadedLoader.import(name, parentURL, { __proto__: null }); |
| 219 | } |
| 220 | |
| 221 | if (reporter?.default) { |
| 222 | reporter = reporter.default; |
| 223 | } |
| 224 | |
| 225 | if (reporter?.prototype && ObjectGetOwnPropertyDescriptor(reporter.prototype, 'constructor')) { |
| 226 | reporter = new reporter(); |
| 227 | } |
| 228 | |
| 229 | if (!reporter) { |
| 230 | throw new ERR_INVALID_ARG_VALUE('Reporter', name, 'is not a valid reporter'); |
| 231 | } |
| 232 | |
| 233 | return { __proto__: null, reporter, destination }; |
| 234 | }); |
| 235 | } |
| 236 | |
| 237 | const reporterScope = new AsyncResource('TestReporterScope'); |
| 238 | const testChannel = tracingChannel('node.test'); |
no test coverage detected
searching dependent graphs…