Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

test: user-subscription specs fail outside UTC, so the pre-commit hook cannot pass

Aperta Adatta ai principianti
#971 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@tejasvasingh2004 ci sta già lavorando.

Dal 25/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
testing

Direzione di ricerca

Inizia da test/unit/repositories/user-subscription-repository.spec.ts ed eseguilo sia con TZ=UTC sia con TZ=America/Toronto per riprodurre i cinque errori. Segui il modo in cui gli spec costruiscono le date limite e il modo in cui il driver delle query le rappresenta; rendi il limite indipendente dal fuso orario locale e verifica il valore passato al driver. Il lavoro è completato quando tutti i 17 spec passano in entrambi i fusi.

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

Descrizione

test/unit/repositories/user-subscription-repository.spec.ts passes under TZ=UTC and fails under any negative-offset zone, so the pre-commit hook cannot pass for anyone running outside UTC — including this development environment, which is America/Toronto.

$ TZ=UTC npx mocha test/unit/repositories/user-subscription-repository.spec.ts
  17 passing

$ TZ=America/Toronto npx mocha test/unit/repositories/user-subscription-repository.spec.ts
  12 passing, 5 failing
     AssertionError: expected 'select * from "user_subscriptions" wh…' to include '"current_period_end" <= '2026-01-31'

All five are the same defect: the specs build a boundary date and assert the literal 2026-01-31 appears in the generated SQL, but the driver renders the value in the local zone, so at UTC-5 the SQL carries a different instant. The two updateIfCurrent failures are the same cause in the IS NOT DISTINCT FROM clause.

CI is UTC, so main is green and the problem is invisible there. It only appears locally, as a pre-commit failure that looks like the change under test is broken.

Fix direction: make the boundary explicit rather than ambient — construct the dates in UTC (or set process.env.TZ = 'UTC' before the module under test is imported, which Node honours for later Date work) and assert on the value the driver is given, not on a date literal that only matches in UTC.

Found while committing an unrelated compose fix (#929).

Lingua principale
TypeScript
Stelle
829
Fork
234
Merge medio
17h 6m
PR unite (30g)
92

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 cameri/nostream

Tutte le issue di cameri/nostream

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.