[Bug]: Using bazel-bin/external/pnpm to run a helper shell file (via package.json script) include unnecessary environment variables breaks tooling

Aperta
#2,012 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
playwright, shell

Direzione di ricerca

Inizia tracciando il modo in cui package.json invoca i file shell di supporto tramite bazel-bin/external/pnpm, quindi confronta l’ambiente passato a un’esecuzione diretta di bazel. Riproduci il comportamento di Playwright in caso di test mancanti e analizza le variabili JS_BINARY_* e NPM_* coinvolte. Il lavoro è completato quando le esecuzioni di bazel attivate da pnpm non propagano più variabili che impediscono a Playwright di individuare i test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug need: more info
What happened?

We have multiple shell files which helps locate build target and build specific arguments to run against bazel test and bazel run. These shell files run bazel commands. To trigger these shell scripts, we have added them to package.json scripts--so we can just pnpm run <script name> <args>.

While trying to add further Playwright integration to update snapshots, we are noticing that Playwright is reporting "missing tests". Upon investigating, we found that bazel-bin/external/pnpm includes a bunch of NPM_* and JS_BINARY_* environment variables to the shell script, which in turn make available to the bazel run call in the script and confuses Playwright. If we were to bazel run directly from the terminal, Playwright can locate the test. It seems that the issue is from these environment variables being included as part of running pnpm as unsetting all of the JS_BINARY_* variables inside the shell script before calling bazel run fixes the issue.

Overall, the problem seem to stem from bazel-bin/external/pnpm as it should not be "leaking" these JS_BINARY_* environment variables.

Version

Development (host) and target OS/architectures:

Output of bazel --version: 7.1.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: 1.42.3

Language(s) and/or frameworks involved: Playwright

How to reproduce

No response

Any other information?

No response

Lingua principale
Starlark
Stelle
383
Fork
189
Merge medio
1g 3h
PR unite (30g)
14

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aspect-build/rules_js

Tutte le issue di aspect-build/rules_js

Issue simili

Altre issue su Build System

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.