ainzzorl / goodcode

A curated collection of annotated code examples from prominent open-source projects
https://codecatalog.org
Creative Commons Attribution 4.0 International
198 stars 8 forks source link

[NEW EXAMPLE] Jest - Diff #52

Closed ainzzorl closed 3 years ago

ainzzorl commented 3 years ago

General

Description

"Jest is a delightful JavaScript Testing Framework with a focus on simplicity.

When the actual output doesn't match the expectation, Jest "displays differences clearly so people can review changes confidently."

E.g. (borrowed from README.md):

const a = ['delete', 'common', 'changed from'];
const b = ['common', 'changed to', 'insert'];

const difference = diff(a, b);
- Expected
+ Received

  Array [
-   "delete",
    "common",
-   "changed from",
+   "changed to",
+   "insert",
  ]

Links

https://github.com/facebook/jest/tree/master/packages/jest-diff

What makes it interesting

Related work

No

Other

No.