You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Automatic migration from other test runners](https://github.com/avajs/ava-codemods#migrating-to-ava)
52
55
56
+
53
57
## Test syntax
54
58
55
59
```js
@@ -88,7 +92,7 @@ Your `package.json` will then look like this:
88
92
"test": "ava"
89
93
},
90
94
"devDependencies": {
91
-
"ava": "^0.17.0"
95
+
"ava": "^0.18.0"
92
96
}
93
97
}
94
98
```
@@ -224,11 +228,15 @@ $ ava --tap | tap-nyan
224
228
225
229
Please note that the TAP reporter is unavailable when using [watch mode](#watch-it).
226
230
227
-
### Clean stack traces
231
+
### Magic assert
232
+
233
+
AVA adds code excerpts and clean diffs for actual and expected values. If values in the assertion are objects or arrays, only a diff is displayed, to remove the noise and focus on the problem. The diff is syntax-highlighted too! If you are comparing strings, both single and multi line, AVA displays a different kind of output, highlighting the added or missing characters.
228
234
229
-
AVA automatically removes unrelated lines in stack traces, allowing you to find the source of an error much faster.
235
+

230
236
231
-
<imgsrc="media/stack-traces.png"width="300">
237
+
### Clean stack traces
238
+
239
+
AVA automatically removes unrelated lines in stack traces, allowing you to find the source of an error much faster, as seen above.
232
240
233
241
234
242
## Configuration
@@ -981,27 +989,31 @@ export default HelloWorld;
981
989
importtestfrom'ava';
982
990
importrenderfrom'react-test-renderer';
983
991
984
-
importHelloWorldfrom'./';
992
+
importHelloWorldfrom'.';
985
993
986
994
test('HelloWorld component', t=> {
987
-
consttree=render.create(<HelloWorld />).toJSON();
988
-
t.snapshot(tree);
995
+
consttree=render.create(<HelloWorld />).toJSON();
996
+
t.snapshot(tree);
989
997
});
990
998
```
991
999
992
1000
The first time you run this test, a snapshot file will be created in `__snapshots__` folder looking something like this:
993
1001
994
-
```
1002
+
```js
995
1003
exports[`HelloWorld component 1`] =`
996
1004
<h1>
997
-
Hello World...!
1005
+
Hello World...!
998
1006
</h1>
999
1007
`;
1000
1008
```
1001
1009
1002
1010
These snapshots should be committed together with your code so that everyone on the team shares current state of the app.
1003
1011
1004
-
Every time you run this test afterwards, it will check if the component render has changed. If it did, it will fail the test. Then you will have the choice to check your code - and if the change was intentional, you can use the `--update-snapshots` (or `-u`) flag to update the snapshots into their new version.
1012
+
Every time you run this test afterwards, it will check if the component render has changed. If it did, it will fail the test.
1013
+
1014
+
<imgsrc="media/snapshot-testing.png"width="814">
1015
+
1016
+
Then you will have the choice to check your code - and if the change was intentional, you can use the `--update-snapshots` (or `-u`) flag to update the snapshots into their new version.
0 commit comments