File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ # Frequently Asked Questions
2+
3+ This FAQ has bits of advice and workarounds for common problems.
4+
5+ ## I'm using Jest and get import errors when I run my test suite
6+
7+ Test suite failures of the form:
8+
9+ ``` text
10+ Cannot find module @opentelemetry/foo/bar from @opentelemetry/...
11+ ```
12+
13+ but package ` @opentelemetry/foo ` is installed may occur with Jest < v29.4.
14+ This is because older versions of ` jest-resolve ` cannot find the nested module
15+ imports used by some OpenTelemetry packages since version 0.56 and higher.
16+ See [ #5618 ] ( https://github.com/open-telemetry/opentelemetry-js/issues/5618 )
17+
18+ Either upgrade to a newer version of Jest to resolve the issue, or use this
19+ workaround for older versions of Jest by adding a ` moduleNameMapper ` rule.
20+ Add this line to your ` jest.config.js ` :
21+
22+ ``` javascript
23+ module .exports = {
24+ moduleNameMapper: {
25+ ' ^@opentelemetry/([^/]+)/(.+)$' : ' <rootDir>/node_modules/@opentelemetry/$1/build/src/index-$2' ,
26+ }
27+ }
28+ ```
You can’t perform that action at this time.
0 commit comments