Proposal: adjust snapshot file label to account for subtest label (~breaking)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 42/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- javascript
- Ambito
- testing-qa
Direzione di ricerca
No files or tests are named. Start by locating the snapshot assertion handling and the snapshot-file reading and writing entry points in this repository. Done means subtest labels replace ordinal labels, and unchanged cases can be migrated with a console notice as described.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem(s) to solve
When a test leverages snapshot assertions, the label of the case within the snapshot file references only suite (describe) and test (it) labels, and then an integer representing the sequential position of that snapshot assertion within the test.
For example:
describe('Widget', () => {
it('should do a thing', (t) => {
t.test('db query', () => t.assert.snapshot(…));
t.test('post request', () => t.assert.snapshot(…));
});
});
Results in a snapshot file like:
exports[`Widget > should do a thing 1`] = `…`; // db query
exports[`Widget > should do a thing 2`] = `…`; // post query
When another snapshot assertion is added between them, Widget > should do a thing 2's value is changed to the new thing (and Widget > should do a thing 3 is appended with the value of what was formerly "2"). This creates two problems:
- a confusing and overly large diff
- a rather unfriendly file for a human to read
Proposed solution(s)
When a subtest wraps the snapshot assertion, use the subtest's label instead of the sequential counter:
exports[`Widget > should do a thing > db query`] = `…`;
exports[`Widget > should do a thing > post query`] = `…`;
We can mitigate a breaking change by temporarily including a migration: when reading the snapshot file, if there is an ordinal and there is a subtest, when the case value is unchanged, replace the ordinal with the subtest label and write it to disk whilst outputting a notice to the console.
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 3
- Fork
- 4
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nodejs/test-runner
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 1/100
nodejs/test-runner#46 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 5/100
nodejs/test-runner#45 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 10/100
nodejs/test-runner#44 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 15/100
nodejs/test-runner#43 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 15/100
nodejs/test-runner#42 ·
Tutte le issue di nodejs/test-runner
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
JdeRobot/RoboticsInfrastructure#843 ·
I maintainer di solito rispondono entro 1 giorno
-
TestAutonomousStop_ReportsObservedState fails under host load: 1s wall-clock ceiling vs 250ms cycleApertatype:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
nightgauge/nightgauge#2909 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
area:agent-manager community needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
area: docs priority: high
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno