* property assertion should only accept strings if nested, fixes#1043
* similar logic seperated out
* test cases for fix#1043
* type check if not isNested with tests
* Tests for assert and should inteface
* Error message change
* changes in should and assert tests as per review
* assert tests modified
* Review comments changes
* review comments fixes
The use of `new Function()` causes an EvalError if the environment's CSP
forbids execution of unsafe-eval. As there's no runtime evaluation being
performed, it's better to use a plain anonymous function instead.
Previously, the `.property` assertion failed ungracefully if the target was `null` or `undefined`. This commit causes an `AssertionError` to be thrown instead so that the ssfi flag and custom error messages are respected.
Most assertions use the term "target" to refer to the object under
test, but a few assertions also had a `target` argument, resulting in
an overloaded term that was difficult to document. This commit
renames every `target` argument to `subject`.
- Make it so that only `AssertionError` is thrown from inside of an
assert interface wrapper function
- Always set `ssfi` to the current function when creating a new
`AssertionError` inside of an assert interface wrapper function
- Always set `ssfi` to the current function when creating a new
`Assertion` inside of an assert interface wrapper function,
and set the `keep_ssfi` flag
- Improve the `globalErr` test helper function to also validate that the
thrown error's stack trace doesn't contain frames from the assert
interface
- Make it so that only `AssertionError` is thrown from inside of an
assertion
- Always pass the current `ssfi` to a `new AssertionError` inside of an
assertion
- Always pass the current `ssfi` to a new `Assertion` inside of an
assertion, and set the `keep_ssfi` flag
- Improve the `globalErr` test helper function to also validate that
the thrown error's stack trace doesn't contain implementation frames
- Allows the `keep_ssfi` flag to be set when creating new Assertion
objects by providing its value as the fourth argument.
- Updates the `transferFlags` util to only transfer `keep_ssfi` when the
`includeAll` argument is set to `true`.
- Updates assertion creation and proxify utils to only set `ssfi` if
`keep_ssfi` isn't set.
- Updates inline docs to reflect expanded usage of `keep_ssfi`.
BREAKING CHANGE: `.change`, `.increase`, and `.decrease` changed from
Chainable Method Assertions to Method Assertions. They don't have any
chaining behavior, and there's no generic semantic benefit to chaining
them.
When neither the `contains` nor `any` flags are set, the `.keys`
assertion implicitly means `.all.keys` and thus requires the target
and given sets to be the same size. Therefore, `not.keys` implicitly
means `.not.all.keys`, and should thus pass when the target and given
sets aren't the same size, even if the target set is a superset of the
given set. This commit enables this behavior.