diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -104,6 +104,7 @@ function matchSnapshot(chai, utils) {
     var dirty = false;
     if (!update && !snapshotState.update && snapshot) {
       if (obj !== snapshot.code) {
+        addSnapshot(path, context.index, lang === undefined ? null : lang, snapshot.code, dirty);
         throw new chai.AssertionError("Received value does not match stored snapshot.", {
           actual: obj,
           expected: snapshot.code,
Fix bug with missing visited flags when test fails