bug: Stencil can resolve incorrect jest-runner dependency when using pnpm
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript
- Lĩnh vực
- testing-qa, tooling
Hướng nghiên cứu
Tái hiện lỗi từ packages/stencil bằng pnpm install, sau đó là pnpm test.spec, rồi lần theo quá trình phân giải runner từ @stencil/core/testing/index.js bằng stack trace được cung cấp. Được xem là hoàn tất khi runner Jest v29 được chọn cho dự án Stencil mặc dù một package khác trong workspace sử dụng Jest v26, và các bài kiểm thử hoàn tất thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Stencil Version
v4.9.0
Current Behavior
In a mono-repo using pnpm where you have mixed dependency versions of Jest, specifically the jest-runner package, Stencil will incorrectly use an older version of the jest-runner package, even though the Stencil project may be configured with a newer version.
For example, in a project that has Jest v29 for the Stencil project, but another package with Jest v26, Stencil will use the test facade for Jest v29, but use the jest-runner@26 instance when executing the test runner.
This results in an exception:
TypeError: Cannot read properties of undefined (reading 'serial')
I've modified the bundle to provide the entire stack trace:
TypeError: Cannot read properties of undefined (reading 'serial')
at e.runTests (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/[email protected]/node_modules/jest-runner/build/index.js:108:27)
at e.runTests (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@stencil/core/testing/index.js:926:19)
at TestScheduler.scheduleTests (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@jest/core/build/TestScheduler.js:283:32)
at async runJest (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@jest/core/build/runJest.js:367:19)
at async _run10000 (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@jest/core/build/cli/index.js:343:7)
at async runCLI (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@jest/core/build/cli/index.js:198:3)
at async runJest (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@stencil/core/testing/index.js:900:10)
at async Object.run (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@stencil/core/testing/index.js:12865:10)
at async taskTest (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@stencil/core/cli/index.cjs:2395:24)
at async runTask (/Users/sean/Documents/ionic/issues/ionic-framework/node_modules/.pnpm/@[email protected]/node_modules/@stencil/core/cli/index.cjs:2514:13)
This behavior is likely driven from pnpm hoisting the dependency, changing the execution location from which Stencil uses to grab the jest-runner instance and invoke it. I suspect we will need to make stricter assumption around where this instance lives, such as from the rootDir of the project, instead of from the executing node_modules.
Expected Behavior
Stencil should resolve its own dependency of the jest-runner, regardless of if the workspace is using another dependency for another project in the mono-repo.
System Info
`npx stencil info` fails with:
> npm ERR! could not determine executable to run
Steps to Reproduce
- Clone the repository - it is a mono-repo.
- Install pnpm, if not already installed: https://pnpm.io/installation
- Install project dependencies:
pnpm install - Run unit tests for the Stencil project:
cd packages/stencil && pnpm test.spec - Observe: Exception is thrown, tests do not run successfully.
- Expected: Tests run successfully.
Code Reproduction URL
https://github.com/sean-perkins/stencil-pnpm-issue
Additional Information
Workarounds:
- Downgrade to the lowest version of Jest that is compatible with Stencil, for example with the reproduction downgrading the Stencil project to Jest v26.
- Upgrade all packages in the mono-repo to the same version of Jest as the Stencil project.
- Use npm or a package manager that does not hoist dependencies.
- Ngôn ngữ chính
- TypeScript
- Star
- 13.2k
- Fork
- 865
- Merge trung bình
- 2 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 29
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của stenciljs/core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug(mock-doc): `Element.toggleAttribute()` is missing, so components that use it fail during SSRĐang mởtriage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Stencil FOUC styles should use @layer to avoid cascade conflicts with React 19Có thể đã có người làm @johnjenkins đã nhận 230 ngày trước. Đang mởStencil v5
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
stenciljs/core#7016 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của stenciljs/core
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
open-webui/tether#52 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`void platform install --app-access public` fails when Cloudflare reports Access is disabledĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
voidzero-dev/void#835 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
AykutSarac/jsoncrack.com#616 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
melgarafael/DeskcommCRM#4679 ·
Maintainer thường phản hồi trong vòng 1 ngày