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

未关闭 适合新手
#1,344 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
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 检查该文件的换行符,并查看第一行(shebang)是否以 \r 结尾。将脚本转换为 LF 后,在 Windows 上重新运行 hub-client 测试,以确认原因。完成标准是测试文件能在 windows-latest 上加载,必要时可为 scripts/*.mjs 在 .gitattributes 中添加 eol=lf 规则。

由索引模型根据 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 分钟
30 天内合并 PR
244

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/q2 的其他 Issue

查看 quarto-dev/q2 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。