vscode breakpoints not being hit in TS mocha tests
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
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- docker-compose, node.js, typescript, vscode
- Lĩnh vực
- developer-experience, devops, testing
Hướng nghiên cứu
Bắt đầu với định nghĩa docker-compose, các cấu hình khởi chạy của VS Code và lệnh test-brk trong package.json. So sánh các lần chạy test trên host và trong container, bao gồm các đường dẫn được dùng cho source được tạo và source maps; được coi là hoàn tất khi các breakpoint của Mocha được phân giải khi chạy test thông qua docker-compose exec.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi
I have a boilerplate express project in TS.
My setup is that I run the project and the build tool chain inside a docker container; the goal being simple replication of dev environments across multiple machines.
The container is managed by the following compose definition:
services:
node:
image: node:12.18.1
hostname: app-node-dev
command: npm run dev
environment:
- HOME=/home/me/workspace/service-kit/sk-base-nodejs
- NODE_ENV=development
ports:
- 8080:8080
- 18080:18080
- 9222:9222
- 9321:9321
volumes:
- ../..:/home/me/workspace/service-kit/sk-base-nodejs:rw
- /etc/group:/etc/group:ro
- /etc/passwd:/etc/passwd:ro
- /etc/shadow:/etc/shadow:ro
- /tmp:/tmp:rw
user: ${_UID}:${_GID}
working_dir: /home/me/workspace/service-kit/sk-base-nodejs
stdin_open: true
tty: true
restart: unless-stopped
Note that I am using the working dir as an exact copy of the absolute path on my host machine.
Previously I was mounting to /workspace but I thought that the unmatching paths may be causing the problem; apparently not.
I mount the passwd/shadow so that I can maintain the file ownership.
I have the following vscode launch configuration to attach to the running app instance:
{
"type": "node",
"request": "attach",
"name": "SK - Attach to Node",
"protocol": "inspector",
"port": 9222,
"restart": true,
"localRoot": "${workspaceFolder}/dist",
"remoteRoot": "/workspace/dist",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"skipFiles": [
"<node_internals>/**/*.js",
]
},
This works great. I can attach and hit breakpoints as expected.
However the problem is when I execute mocha tests via the following launch configuration:
{
"type": "node",
"request": "launch",
"name": "SK - Mocha Tests Bak",
"cwd": "${workspaceRoot}",
"runtimeExecutable": "make",
"runtimeArgs": [
"npm",
"run",
"test-brk"
],
"env": {
"NODE_ENV": "test-external",
},
"port": 9321,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector",
"sourceMaps": true,
},
One key unusual thing here is that I am executing make npm run test-brk. This make command translates to a docker-compose exec that runs npm run test-brk within the running container.
The test-brk command in the package.json is defined as:
"test-brk": "mocha --require node_modules/ts-node/register --inspect-brk=0.0.0.0:9321 --debug-brk --exit test/**/*.spec.ts",
When I launch the debug config in vscode the tests launch and execute and pass; but the breakpoints are not hit.
`Breakpoint ignored because generated source not found (source map problem?)`
Here is where things get interesting. The above execution runs the npm run test-brk within the container. If I install node on my dev machine and execute npm run test-brk from my host then everything works as expected - the tests run and the breakpoints are hit.
In short - it appears that vscode cannot find the source maps if I run mocha from within the container. But the source maps are found if I run mocha from on the host.
Is there something that I am missing that gets generated within the container that vscode cannot access? even though the workspace folder is mounted?
I would really appreciate any input on this.
Node is version 12.18.1
Source map support 0.5.19
- Ngôn ngữ chính
- JavaScript
- Star
- 2.2k
- Fork
- 221
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 evanw/node-source-map-support
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
evanw/node-source-map-support#344 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
evanw/node-source-map-support#343 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
evanw/node-source-map-support#337 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
evanw/node-source-map-support#333 ·
-
Provide esm versionĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
evanw/node-source-map-support#330 · 2 bình luận · 9 reaction ·
Tất cả issue của evanw/node-source-map-support
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
[BUG] Tools returned by input processors get an empty context.agent.agentIdCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở@mastra/core effort:low impact:medium status: auto-triaged Tools
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
mastra-ai/mastra#26794 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
release:v5.34
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Jason-Vaughan/TangleClaw#2365 ·
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 76/100
-
enhancement
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
holepunchto/hrpc-test#28 ·