This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request updates dependency ava from version
0.18.2
to0.19.1
Changelog
0.19.1 / 2017-04-10
Fixes #1347
Fixes #1345.
0.19.0 / 2017-04-05
It's risky to pass a function to a map() operation, and indeed since
[email protected] the getPort() function takes a first argument.
`t.throws()` and `t.notThrows()` can be called with an observable or
promise. This commit forces users to wait for the assertion to complete
before finishing the test. Usually this means the test has to be written
like:
```js
test(async t => {
await t.throws(Promise.reject(new Error()))
})
```
Or for callback tests:
```js
test.cb(t => {
t.throws(Promise.reject(new Error())).then(t.end)
})
```
This simplifies internal logic and helps discourage code like in #1327.
Anecdotally users are surprised by the previous behavior where a
synchronous test worked with an asynchronous assertion
(Too aggressive in declaring the test "finished" avajs/ava#1327 (comment)).
Fixes #1327.
Fixes #843
(Switch to disable color output to console avajs/ava#843 (comment)). Values
shouldn't be highlighted during formatting if colors are disabled.
`t.snapshot()` assertion.
to generate the diff if the snapshot doesn't match. This does mean the
output is not colored and has other subtle differences with how other
assertions format values, but that's OK for now. Fixes #1220, #1254.
using private APIs and making other assumptions, so I'm not comfortable
with using a loose SemVer range.
instance. Actual code only exposed the `test` method to the user, and
that happens to be the default starting point anyway
TypeScript definition
Show instructions on how to use `t.throws()` with the test results,
without writing them to stderr. Detect the improper usage even if user
code swallows the error, meaning that tests will definitely fail.
Assume that errors thrown, or emitted from an observable, or if the
returned promise was rejected, that that error is due to the improper
usage of `t.throws()`.
Assume that if a test has a pending throws assertion, and an error leaks
as an uncaught exception or an unhandled rejection, the error was
thrown due to the pending throws assertion. Attribute it to the test.
The formatted labels sometimes assume the context of the error message.
And, since formatted values can be quite long, it's odd to see the
message only at the very end.
If the source is known through other means it doesn't have to be derived
from the assertion error's stack trace.
Fixes #1321
If a pending assertion fails before the test implementation returns a
rejected promise, the assertion failure should cause the test to fail,
not the promise rejection.
There are too many parameters.
If the assertion fails, the AssertionError no longer has access to the
stack of when the assertion was called. Record it before entering the
promise chain.
Rather than keeping an infinite timer open, waiting for `t.end()` to be
called, fail the callback test if it is not ended when the event loop
empties.
Similarly, fail promise/observable returning tests if the promise hasn't
fulfilled or the observable hasn't completed when the event loop
empties.
Note that user code can keep the event loop busy, e.g. if it's listening
on a socket or starts long timers. Even after this change, async tests
may hang if the event loop is kept busy.
Though currently this error is likely to get lost unless there is a
pending assertion or `test.cb()` is used.
are generally not worth it
calling code
validated in `test-collection.js`
*Pass metadata when instantiating Tests
due to the `test.cb()` API, but it's now a lot easier to understand.
Due to the last change, tests with `t.end()` and only synchronous
assertions end immediately. Previously they would end asynchronously
due to a promise being in the completion chain.
Similarly, returning a promise or observable for a `test.cb()` test
immediately fails.
Test results are emitted directly, so Test#run() only needs to return a
(promise for) a boolean, indicating whether the test passed.
Make the same change in Concurrent and Sequence, and return a boolean
if all runnables passed.
Refactor tests to stop relying on Test instances returning their result.
There's no need to collect all results. Tests emit them directly.
Simplify Runner by passing options to TestCollection.
Asynchronous `t.throws()` / `t.notThrows()` was the only case where
internal AssertionErrors were leaked to user code. Return `undefined`
instead.
`adapter` instead. Use the `process` global where applicable. Masking
the process global with a mimicked object is unnecessarily confusing.
The worker now only exits when told by the main process. This means the
IPC channel must have drained before the main process can send the
instruction. There's no need to wait before sending the message that
teardown has completed.
The AppVeyor workaround was introduced to solve Node.js 0.10 issues.
We're no longer supporting that version. In theory, issues around
flushing I/O exist regardless of whether AVA is running in AppVeyor.
There is no clear way around this though, so let's assume it's not
actually an issue.
Don't make the duration comparison so precise, since timers may fire
early.
Only print the first level. For arrays/maps/objects/sets this means the
indexes/keys are printed. Presumably since we do print all statements
this provides enough context.
Format statements, generate diffs and otherwise format values when
AssertionErrors are created. Make labels contextual to the assertion.
Always print power-assert statements in mini and verbose reporters, but
after the values. Accept the duplication when the statement covers the
value passed to the assertion.
Detect whether `t.throws()` failed because no error was thrown, or because
the thrown error did not meet expectations.
Explicitly test `t.fail()` default message in assertion test.
At best it saves one stack level, but AVA code is already filtered out
of the stacks, so this is really quite unnecessary.
Wrap callback errors, rejected promises or synchronously thrown values
in an `AssertionError`. Rely on the `actual` value being printed by the
reporters, which means it's still shown to the user.
Remove now obsolete `Error: ` prefix added to non-assertion errors in
`run-status.js`. Instead more helpful messages from `test.js` can be
shown.
Try to reuse the stack trace from any original error, so magic assert
can show context.
Fail `t.throws()` / `t.notThrows()` with an AssertionError if called
with an improper argument, rather than throwing a TypeError.
This is especially useful for `t.notThrows()`, which includes the
thrown exception as the `actual` value for the assertion error.
Fixes #1150.
Avoid having to normalize errors in `run-status.js`.
rather than abusing the operator field. We can also stop depending on
`core-assert` once we implement `t.throws()` ourselves. Reserve the
`statements` property for power-assert output
varying options
in the mini and verbose reporters
and use `===` as the operator
fixing #1227
sat kind of awkwardly in `assert.js`
if actual / expected values are available when formatting
to wrap the others
assertions create `AssertionError`s with the correct message
internals. Note that only `t.throws()` and `notThrows()` are (possibly)
asynchronous
This matches the terminology used in the README.
It's undocumented and unused.
This assumes they're serialized in the test workers
here we want the full line
Fixes #707
`diff` is really slow for large strings
Node.js 7.6.0 supports async / await so the test doesn't throw an
exception. Use the unsupported module syntax instead.