Priva Leuga
Priva Leuga

Reputation: 25

I am getting a yarn error when issuing the git commit command

I am working on a react native project folder and I am able to load it in the simulator correctly. But, when I try to commit my change to gitHub, I have this error coming up.

Commit failed - exit code 1 received, with output: 'husky > npm run -s precommit (node v8.9.3)

yarn run v1.3.2 $ jest && eslint . FAIL src/screens/Compose/tests/index.test.js ● renders correctly

expect(value).toMatchSnapshot()

Received value does not match stored snapshot 1.

- Snapshot
+ Received

@@ -98,14 +98,45 @@
             testID={undefined}
             tvParallaxProperties={undefined}
           >
             <Text
               accessible={true}
-              allowFontScaling={true}
+              active={true}
+              allowFontScaling={false}
               disabled={false}
               ellipsizeMode="tail"
-            />
+              style={
+                Array [
+                  Object {
+                    "color": undefined,
+                    "fontSize": 12,
+                  },
+                  Array [
+                    Object {
+                      "color": "#000",
+                      "fontSize": 30,
+                    },
+                    Object {
+                      "color": "#007aff",
+                      "fontSize": 33,
+                      "marginLeft": 2,
+                      "marginRight": 2,
+                      "marginTop": 2,
+                      "paddingTop": 2,
+                    },
+                  ],
+                  Object {
+                    "fontFamily": "Ionicons",
+                    "fontStyle": "normal",
+                    "fontWeight": "normal",
+                  },
+                ]
+              }
+              virtual={undefined}
+            >
+              
+            </Text>
           </View>
         </View>
         <View
           style={
             Object {

  at Object.<anonymous> (src/screens/Compose/__tests__/index.test.js:9:14)
  at tryCallTwo (node_modules/promise/lib/core.js:45:5)
  at doResolve (node_modules/promise/lib/core.js:200:13)
  at new Promise (node_modules/promise/lib/core.js:66:3)
  at Promise.resolve.then.el (node_modules/p-map/index.js:46:16)
  at tryCallOne (node_modules/promise/lib/core.js:37:12)
  at node_modules/promise/lib/core.js:123:15

✕ renders correctly (71ms)

Snapshot Summary › 1 snapshot test failed in 1 test suite. Inspect your code changes or run with yarn test -- -u to update them.

Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 1 failed, 1 total Time: 1.027s Ran all test suites. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

husky > pre-commit hook failed (add --no-verify to bypass)'

Upvotes: 1

Views: 5915

Answers (1)

Priva Leuga
Priva Leuga

Reputation: 25

After digging for a while, based on #4992 and this, I deleted index.test.js.snap, issued the snapshot update command and the index.test.js.snap got created again, which fixed my problem.

rm src/screens/Compose/__tests__/__snapshots__/index.test.js.snap 
npm test --u

Upvotes: 1

Related Questions