fix(scripts): make the test script runnable on Windows - #3040
fix(scripts): make the test script runnable on Windows#3040KallinikosMil wants to merge 1 commit into
Conversation
The `test` script prefixed jest with a POSIX inline environment variable
assignment. cmd.exe has no such syntax, so on Windows `pnpm test` fails before
jest starts:
'TS_JEST_DISABLE_VER_CHECKER' is not recognized as an internal or external
command, operable program or batch file.
The variable is also no longer doing anything. `TS_JEST_DISABLE_VER_CHECKER`
opted out of a version-mismatch warning that ts-jest has since removed; in the
resolved ts-jest (29.4.6) the name appears only in its CHANGELOG, not in any
runtime code. Running jest without it produces no warning.
`watch`, `watch:debug` and `coverage` already invoke jest bare, so dropping
the prefix also makes `test` consistent with them.
|
The CircleCI failure here is pre-existing and unrelated to this change — flagging it so the red X doesn't stall the review. What actually fails: two cases in
Evidence it isn't mine: builds 5117 and 5116, on the unrelated Also worth noting the run reached jest at all — the log opens with Happy to open a separate PR for the |
Description
pnpm testcannot run at all on Windows. Thetestscript prefixes jest with a POSIX inline environment variable assignment:cmd.exe has no equivalent syntax, so the shell tries to execute the assignment as a command and the run dies before jest starts:
That's a fresh
git clone && pnpm install && pnpm teston Windows 11 — a contributor on Windows can't run the suite before opening a PR.Why removing the variable rather than wrapping it
TS_JEST_DISABLE_VER_CHECKERopted out of a TypeScript version-mismatch warning that ts-jest has since dropped. In the ts-jest this repo resolves (29.4.6, fromts-jest: ^29.1.1), the name appears only inCHANGELOG.md—grep -ril ver_checker node_modules/…/ts-jest/dist/returns nothing. Running jest without it emits no warning of any kind:So the prefix costs a hard failure on Windows and buys nothing.
There's also a consistency argument:
watch,watch:debugandcoveragealready invoke jest bare.testwas the only one carrying the prefix.If you'd rather keep the variable — say, to stay covered should the checker ever return — the cross-platform form is
cross-env:That needs a new devDependency, which is why I didn't reach for it first. Happy to switch if you prefer it.
Checklist
README.mdand other relevant documentation has been updated with my changes — no documentation references this script's env var.src/tools, 19 tests, 3 suites) before and after on Windows 11 / Node 22.23.2 / pnpm 10.9.0. I did not run thetest/vanillae2e specs, which generate real apps and need a full RN toolchain; this change doesn't touch generation, only how jest is invoked. CI (CircleCI,cimg/node:20.19.4) runs Linux only, so the whole suite there is unaffected either way —jestpicks up the same config with or without the variable.Verification
Before (on
master)After
On Linux/macOS the behaviour is unchanged: the variable was already a no-op there, so jest receives exactly the same configuration.