env variable DEBUG is not parsed correctly

Offen
#989 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
javascript
Bereich
tooling

Rechercherichtung

Start in debug/src/common.js around line 169 and inspect how the DEBUG string is split. Verify that multiple space-separated namespaces are all recognized, including the APP_X APP_Y APP_Z example; the issue does not mention a specific test file to run.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

If the DEBUG env variable contains multiple items separated with spaces, then only the first one is used.

For example:
export DEBUG="APP_X APP_Y APP_Z"

Then, only the APP_X is enabled for debugging. Other apps are ignored. This is due to the way the string is parsed:

In debug\src\common.js, line 169:

const split = (typeof namespaces === 'string' ? namespaces : '') .trim() .replace(' ', ',') .split(',') .filter(Boolean);

replace('', ',') changes only the first occurrence of space

So, to fix it you can use regexp:

const split = (typeof namespaces === 'string' ? namespaces : '') .trim() .replace(/ /g, ',') .split(',') .filter(Boolean);

Vorherrschende Sprache
JavaScript
Sterne
11.5k
Forks
992
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus debug-js/debug

Alle Issues in debug-js/debug

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.