Roblox / testez

BDD-style test and assertion library for Roblox Lua
https://roblox.github.io/testez/
Apache License 2.0
183 stars 58 forks source link

New assertion library #67

Open LPGhatguy opened 4 years ago

LPGhatguy commented 4 years ago

We've slowly been becoming less happy about Expectation as our assertion syntax.

It might be a good idea to involve a new assertion library and syntax, like the one from Busted, which is more flexible. Some examples from Busted:

-- deep check comparisons!
assert.are.same({ table = "great"}, { table = "great" })

-- or check by reference!
assert.are_not.equal({ table = "great"}, { table = "great"})

assert.truthy("this is a string") -- truthy: not false or nil

assert.True(1 == 1)
assert.is_true(1 == 1)

assert.falsy(nil)
assert.has_error(function() error("Wat") end, "Wat")
amoss-roblox commented 4 years ago

I quite like this provided we have better docs than Busted! Jest (https://jestjs.io/docs/en/expect) and jest extended (https://github.com/jest-community/jest-extended) are good.

We should add https://jestjs.io/docs/en/expect#expectextendmatchers so that people can extend Expectation

amoss-roblox commented 4 years ago

Aha I see https://github.com/Roblox/testez/pull/62 has implemented extend