Skip to content

Stop the environment-gated test scripts depending on sh - #16

Merged
rponeawa merged 1 commit into
mainfrom
portable-test-scripts
Aug 20, 2026
Merged

rponeawa merged 1 commit into
mainfrom
portable-test-scripts

Conversation

@rponeawa

Copy link
Copy Markdown
Member

Three scripts were written in shell that only one shell speaks. pnpm hands a script body to /bin/sh on POSIX and to cmd.exe on Windows, and what sh reads as syntax cmd.exe reads as text. None of the three run in CI, so nothing would have reported this.

The loud one

VAR=1 command is POSIX shell. cmd.exe has no such form and looks for a program named HYPIT_BROWSER_TESTS=1. It fails where you can see it, which makes it the harmless one.

The quiet one

The same defect this repository already found in its main suite, in a second place. sh strips the quotes around the discovery pattern and unittest receives test_*.py; cmd.exe does not, and unittest receives six characters that match no file. Measured locally:

-p 'test_*.py'   quotes stripped   Ran 11 tests   OK             exit 0
-p 'test_*.py'   quotes literal    Ran 0 tests    NO TESTS RAN   exit 0

Both exit 0. On Windows this script would report success having run nothing — exactly what node --test does with a glob that matches nothing.

Double quotes are stripped by both shells, so this one needs no runner, only the right quote.

The third

test:image-opencv also named the POSIX interpreter path outright — services/image-opencv/.venv/bin/python, where Windows puts .venv\Scripts\python.exe. provider-image-opencv-local/src/deployment.ts has branched on the platform for that venv all along; only the script bypassed it.

What changed

The two environment gates move into test/run.mjs, which already exists for this class of problem, as named suites — node test/run.mjs browser-visual and node test/run.mjs image-opencv — where the gates are assignments rather than shell syntax and the venv path is a platform branch in JS. An environment already set by the caller still wins: these are defaults for running a suite, not a policy about it. An unknown suite name is refused rather than silently running everything.

The testing guide listed HYPIT_OPENCV_TESTS=1 and HYPIT_OPENCV_PYTHON as prerequisites the reader supplies; the script supplies them now, so both language versions say what is actually still required.

Verification

pnpm check, pnpm test (544, 0 failures), pnpm test:release (8), pnpm test:whisperx-service (11), pnpm test:browser-visual (12 against a real browser) all pass. pnpm test:image-opencv reports 2 passed and 2 skipped here, the skips being the live tests with no venv present. node test/run.mjs nope exits 2.

🤖 Generated with Claude Code

Three scripts were written in shell that only one shell speaks. pnpm hands a
script body to /bin/sh on POSIX and to cmd.exe on Windows, and what sh reads as
syntax cmd.exe reads as text.

`VAR=1 command` is the loud one: cmd.exe has no such form and looks for a
program named `HYPIT_BROWSER_TESTS=1`. It fails where you can see it.

The quoted discovery pattern is the quiet one, and it is the same defect this
repository already found in its main suite. sh strips the quotes and unittest
receives `test_*.py`; cmd.exe does not, and unittest receives six characters
that match no file. Both exit 0:

    -p 'test_*.py'    stripped   Ran 11 tests   OK             exit 0
    -p 'test_*.py'    literal    Ran 0 tests    NO TESTS RAN   exit 0

Double quotes are stripped by both shells, so the pattern needs no runner —
only the right quote. The two environment gates move into the runner that
already exists for this, as named suites, where they are assignments rather
than syntax. That also settles the third defect: the OpenCV script named the
POSIX interpreter path outright, though `deployment.ts` has branched on the
platform for that venv all along.

An environment already set by the caller still wins. These are defaults for
running a suite, not a policy about it.

Co-Authored-By: Claude <[email protected]>
@rponeawa
rponeawa merged commit d278ead into main Aug 20, 2026
2 checks passed
overlordkim pushed a commit that referenced this pull request Sep 9, 2026
Stop the environment-gated test scripts depending on sh
overlordkim pushed a commit that referenced this pull request Sep 9, 2026
Stop the environment-gated test scripts depending on sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant