Proposal: adjust snapshot file label to account for subtest label (~breaking)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 42/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- javascript
- Bereich
- testing-qa
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 3
- Forks
- 4
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus nodejs/test-runner
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 1/100
nodejs/test-runner#46 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 5/100
nodejs/test-runner#45 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 10/100
nodejs/test-runner#44 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 15/100
nodejs/test-runner#43 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 15/100
nodejs/test-runner#42 ·
Alle Issues in nodejs/test-runner
Ähnliche Issues
-
area-testing p2-post-1.0 technical-debt
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Recommended for Recruits
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 62/100
UTDNebula/utd-notebook#304 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
bug P3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
follow-up
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 62/100
carrick-sh/carrick#1494 ·
Maintainer antworten meist innerhalb von 1 Tag