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

Jest parameterized tests doesn't run correctly

Aperta
#2,399 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
javascript, node.js

Direzione di ricerca

Riproduci il problema di app.test.js in un progetto Visual Studio Test Explorer usando i casi di test parametrizzati Jest elencati. Inizia esaminando come Test Explorer individua ed esegue questi test; il lavoro è terminato quando ogni caso parametrizzato è elencato ed eseguito in modo indipendente, inclusi i test con nomi parametrizzati.

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

Descrizione

Expected Behavior

Test Explorer should list down parameterized tests independently and run them correctly

Actual Behavior

Test explorer only shows and runs the first test and it also breaks when you try to include parameters in the test name.

  • NTVS Version: 1.5.40404.3
  • Visual Studio Version: 2022
  • Node.js Version: 16.15.1
Steps to Reproduce
  1. Create a new project using docs : https://docs.microsoft.com/en-us/visualstudio/javascript/tutorial-create-react-app?view=vs-2022
  2. In app.test.js, added a parameterized jest test.
test.each([
    [true, true],
    [false, false]
])('dummy test', (a, b) => {
    expect(a).toBe(b);
});
  1. When I build the project and open test explorer, it was expected to show two tests, but shows a single one
    image

  2. If I change the test to something which is expected to fail, like

test.each([
    [true, true],
    [false, true]
])('dummy test', (a, b) => {
    expect(a).toBe(b);
});

The test explorer shows that the test still passes, which is because it seems to only run the first test

  1. If I change the test name to be something parameterized,
test.each([
    [true, true],
    [false, false]
])('expect %p to be %p', (a, b) => {
    expect(a).toBe(b);
});

then the test fails in test explorer and test explorer doesn't show it correctly
image

Lingua principale
C#
Stelle
1.8k
Fork
355
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 microsoft/nodejstools

Tutte le issue di microsoft/nodejstools

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.