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

Open Beginner friendly
#1,344 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
git, javascript, node.js, typescript

Research direction

The failing import is in hub-client/src/pandoc/pruneEmbedDist.test.ts, which loads scripts/prune-embed-dist.mjs. Check the file's line endings with git ls-files --eol and see whether its first line, the shebang, ends in \r. Confirm the cause by converting the script to LF and rerunning the hub-client tests on Windows. Done means the test file loads on windows-latest, possibly with an eol=lf rule added to .gitattributes for scripts/*.mjs.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Rust
Stars
316
Forks
23
Avg merge
8h 19m
Merged PRs (30d)
244

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quarto-dev/q2

All issues in quarto-dev/q2

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.