Snapshot

extensions/snapshot/Snapshot~ Snapshot

Snapshot extension.

Constructor

new Snapshot(options)

Source:
Parameters:
Name Type Description
options Object Options
Name Type Attributes Default Description
updateSnapshots boolean <optional>
false Should we update the snapshots
cleanSnapshots boolean <optional>
false Should we clean the snapshot to remove unused snapshots

Methods

expectToMatch(expectedContent)

Compare a content to it's snapshot. If no snapshot yet, it create it. It uses the context to name the snapshot: feature file, scenario name and nth snapshot of scenario Snapshot name will be by default stored in FEATURE_FILE_FOLDER_PATH/__snapshots__/FEATURE_FILE_NAME.snap And snapshot name will be "SCENARIO_NAME NUMBER_OF_TIME_SCNEARIO_NAME_APPEARD_IN_FEATURE.NUMBER_OF_TIME_WE_SNAPSHOTED_IN_CURRENT_SCENARIO" For the first scenario of a scenario called "Scenario 1" that only appears once in feature file, snapshot name will be "Scenario 1 1.1" If option "-u" or "--updateSnapshots" is used, all snapshots will be updated If options "--cleanSnapshots" is used, unused stored snapshots will be removed.
Source:
Parameters:
Name Type Description
expectedContent * Content to compare to snapshot
Throws:
If snapshot and expected content doesn't match, it throws diff between both
Type
string