I mean how is
expect(2).toBeLessThanOrEqualTo(3)
more readable than assert(2 <= 3)
Especially when we have packages like power-assert (1)I mean how is
expect(2).toBeLessThanOrEqualTo(3)
more readable than assert(2 <= 3)
Especially when we have packages like power-assert (1)A) It doesn't require transforms to bring you good messages.
B) <= is an "easy" case, but what about deep equality, recursive matchers[1], or snapshots[2]?
[1]: http://facebook.github.io/jest/docs/expect.html#expectobject... [2]: http://facebook.github.io/jest/docs/snapshot-testing.html
That's a pretty big requirement.
I usually avoid the long names like that, but doing `expect(3).toEqual(4)` isn't too bad and it allows the test runner to provide really good error messages.
1. A test that reads as natural language is easy to understand. Straightforward, declarative tests are a big win IMO. 2. This allows for better test result reporting: instead of assertion failed, the utility can tell you more (expected 4 but got 3).