From d8b063e5090d5de1a387ec84a72b9645d2cae8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20=C3=85str=C3=B6m?= Date: Mon, 17 Sep 2018 08:54:33 +0200 Subject: [PATCH] fix(snapshot): clear state (#370) Ensure clearing the snapshot state when rerunning tests --- commands/node/src/index.js | 1 + .../test/__snapshots__/button.spec.js.snap | 36 ------- .../__snapshots__/fancy-button.spec.js.snap | 96 ------------------- 3 files changed, 1 insertion(+), 132 deletions(-) diff --git a/commands/node/src/index.js b/commands/node/src/index.js index 6e502d73..04a76fe2 100644 --- a/commands/node/src/index.js +++ b/commands/node/src/index.js @@ -218,6 +218,7 @@ class Runner extends EventEmitter { } setupAndRunTests(testFiles, srcFiles) { + this.snapshotStates.clear(); process.removeAllListeners(); if (this.mochaRunner) { this.mochaRunner.removeAllListeners(); diff --git a/examples/react/test/__snapshots__/button.spec.js.snap b/examples/react/test/__snapshots__/button.spec.js.snap index 4fe06db3..18c9b447 100644 --- a/examples/react/test/__snapshots__/button.spec.js.snap +++ b/examples/react/test/__snapshots__/button.spec.js.snap @@ -12,44 +12,8 @@ exports[`'renders correctly' 2`] = ` `; -exports[`'renders correctly' 3`] = ` - -`; - -exports[`'renders correctly' 4`] = ` - -`; - -exports[`'renders correctly' 5`] = ` - -`; - -exports[`'renders correctly' 6`] = ` - -`; - exports[`'renders fancy' 1`] = ` `; - -exports[`'renders fancy' 2`] = ` - -`; - -exports[`'renders fancy' 3`] = ` - -`; diff --git a/examples/react/test/__snapshots__/fancy-button.spec.js.snap b/examples/react/test/__snapshots__/fancy-button.spec.js.snap index d8e6bbd6..17ce8ed6 100644 --- a/examples/react/test/__snapshots__/fancy-button.spec.js.snap +++ b/examples/react/test/__snapshots__/fancy-button.spec.js.snap @@ -8,22 +8,6 @@ exports[`'renders fancy with button as is from import' 1`] = ` `; -exports[`'renders fancy with button as is from import' 2`] = ` -
- -
-`; - -exports[`'renders fancy with button as is from import' 3`] = ` -
- -
-`; - exports[`'renders fancy with button as is' 1`] = `
`; -exports[`'renders fancy with button as is' 2`] = ` -
- -
-`; - -exports[`'renders fancy with button as is' 3`] = ` -
- -
-`; - exports[`'renders fancy with button as span or div' 1`] = `
@@ -64,54 +32,6 @@ exports[`'renders fancy with button as span or div' 2`] = `
`; -exports[`'renders fancy with button as span or div' 3`] = ` -
- - hhhhh - -
-`; - -exports[`'renders fancy with button as span or div' 4`] = ` -
-
- ggggg -
-
-`; - -exports[`'renders fancy with button as span or div' 5`] = ` -
- - hhhhh - -
-`; - -exports[`'renders fancy with button as span or div' 6`] = ` -
-
- ggggg -
-
-`; - -exports[`'renders fancy with button as span' 1`] = ` -
- - hhhhh - -
-`; - -exports[`'renders fancy with button as span' 2`] = ` -
-
- ggggg -
-
-`; - exports[`'renders fancy with button mock from file' 1`] = `
@@ -119,19 +39,3 @@ exports[`'renders fancy with button mock from file' 1`] = `
`; - -exports[`'renders fancy with button mock from file' 2`] = ` -
- - file mock - -
-`; - -exports[`'renders fancy with button mock from file' 3`] = ` -
- - file mock - -
-`;