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

オープン 初心者向け
#1,344 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
git, javascript, node.js, typescript

調査の方向性

失敗しているインポートは hub-client/src/pandoc/pruneEmbedDist.test.ts にあり、これは scripts/prune-embed-dist.mjs を読み込みます。git ls-files --eol でファイルの改行コードを確認し、先頭行であるシェバンが \r で終わっているかを調べてください。スクリプトを LF に変換してから Windows 上で hub-client のテストを再実行し、原因を確認します。テストファイルが windows-latest で読み込めれば完了です。必要に応じて scripts/*.mjs に対する eol=lf のルールを .gitattributes に追加してもかまいません。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
316
フォーク
23
平均マージ
8時間 19分
マージ済み PR(30日)
244

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quarto-dev/q2 のほかの issue

quarto-dev/q2 の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。