requires: declare commands that must resolve, and report where each landed

Đang mở
#54 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
52/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
cli, testing-qa

Hướng nghiên cứu

Bắt đầu bằng việc truy vết cách front matter xử lý path: và PATH đã ghép được truyền tới các session như thế nào, sau đó kiểm tra hành vi mở rộng env: hiện có và golden-test runner. Thêm bước phân giải requires: trước session đầu tiên, tuân theo PATHEXT và nêu các thư mục đã tìm khi thất bại. Báo cáo từng lệnh đã phân giải, đường dẫn của lệnh, số lượng tệp và số lượng session để một lần chạy cho thấy nó thực sự đã kiểm thử những gì.

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

Mô tả

tryscript resolves a command through PATH and says nothing about where it landed. For a
golden suite, that is the difference between a proven result and a green check.

A golden test's whole claim is that a particular program produced particular bytes.
path: prepends to the inherited PATH rather than replacing it, so if a declared entry
fails to resolve — variable unset, build directory cleaned, a typo, a cross-compiled
layout — lookup continues into the inherited PATH and finds whatever is installed there.
The suite then passes while exercising a build nobody selected, with no diagnostic.

That is not hypothetical. It happened in fdu: every golden selected its build with
path: - $TRYSCRIPT_GIT_ROOT/target/debug, and whenever that failed to resolve the
sessions silently fell through to ~/.cargo/bin/fdu — the developer's installed copy —
and passed.

Proposal

requires:
  - fdu

Named commands must resolve before the first session runs. If one does not, abort with a
message naming the command and the directories searched, rather than letting a hundred
confusing diffs appear later.

And report where each landed:

resolved fdu -> /…/target/debug/fdu   (12 files, 129 sessions)

The reporting half is the one that matters. It makes a run legible rather than merely
correct — the same reason a good test harness says what it ran, not just whether it
passed. Today the only way to know which binary a suite exercised is to reason about
PATH composition and hope.

Notes

  • Lookup should respect PATHEXT on Windows rather than assuming a bare name.
  • Resolution should use the same composed PATH the sessions get, including path:
    entries, so it answers the question the sessions will actually ask.
  • Worth failing rather than warning: a suite that runs without the program it is about
    does not produce a weaker result, it produces a meaningless one.

Context

fdu worked around this by naming the binary's directory through a variable and
preflighting it in an external runner script before invoking tryscript. That works, but it
is machinery every project would otherwise have to build for itself, and it cannot report
what tryscript itself resolved.

Related: jlevy/tryscript#51, which made env: expand variables the way path: already
did — the same family of "front matter should be able to say what it means about which
program runs".

Ngôn ngữ chính
TypeScript
Star
13
Fork
1
Merge trung bình
3 giờ 38 phút
Pull request đã merge (30 ngày)
3

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

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 jlevy/tryscript

Tất cả issue của jlevy/tryscript

Issue tương tự

Thêm issue về TypeScript

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.