Windows: hub-client pruneEmbedDist.test.ts fails to load with a SyntaxError

Đang mở Phù hợp với người mới
#1,344 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, javascript, node.js, typescript
Lĩnh vực
build-system, testing-qa

Hướng nghiên cứu

Lỗi import nằm ở hub-client/src/pandoc/pruneEmbedDist.test.ts, file này tải scripts/prune-embed-dist.mjs. Kiểm tra kiểu xuống dòng của file bằng git ls-files --eol và xem dòng đầu tiên, tức shebang, có kết thúc bằng \r hay không. Xác nhận nguyên nhân bằng cách chuyển script sang LF rồi chạy lại các test của hub-client trên Windows. Hoàn thành khi file test tải được trên windows-latest, có thể kèm quy tắc eol=lf trong .gitattributes cho scripts/*.mjs.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug testing windows

src/pandoc/pruneEmbedDist.test.ts is the only hub-client test file that fails on windows-latest. It fails at import, before any test runs:

https://github.com/quarto-dev/q2/actions/runs/45608700263

FAIL src/pandoc/pruneEmbedDist.test.ts [ src/pandoc/pruneEmbedDist.test.ts ]
SyntaxError: Invalid or unexpected token

The test imports scripts/prune-embed-dist.mjs:

https://github.com/quarto-dev/q2/blob/49036fc2d6f8dfc4eeddb7b44f3ad69be313aad2/hub-client/src/pandoc/pruneEmbedDist.test.ts#L5

That file starts with a shebang, and on my Windows checkout it has CRLF (#!/usr/bin/env node\r\n, git ls-files --eol reports i/lf w/crlf). No .gitattributes rule covers scripts/*.mjs. I think the \r after the hashbang is what breaks the load, but I haven't confirmed it by converting the file to LF.

We could pin scripts/*.mjs to eol=lf, since the shebang is executed verbatim.

Related: #1275.

Ngôn ngữ chính
Rust
Star
316
Fork
23
Merge trung bình
8 giờ 19 phút
Pull request đã merge (30 ngày)
244

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/q2

Tất cả issue của quarto-dev/q2

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.