Skip to content

Commit

Permalink
fix: use path.resolve for custom reporters to be compatible with yarn…
Browse files Browse the repository at this point in the history
  • Loading branch information
massimeddu-sonic committed Dec 6, 2021
1 parent a64b72a commit 51a305e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/server/lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,13 @@ class Reporter {
throw err
}

p = path.resolve(projectRoot, 'node_modules', reporterName)

try {
p = path.resolve(projectRoot, 'node_modules', reporterName)
} catch (err) {
// If we are not able to import with path.resolve, try with the require.resolve
// useful for example when Yarn PnP is used. See: #18922
p = require.resolve(reporterName, { paths: [projectRoot] })
}
// try npm. if this fails, we're out of options, so let it throw
debug('trying to require local reporter with path:', p)

Expand Down

0 comments on commit 51a305e

Please sign in to comment.