Closed greenkeeper[bot] closed 7 years ago
Update to this version instead 🚀
A bugfix release. See 0.19.0
for full release notes.
The new version differs by 5 commits .
4cc3403
0.19.1
d169f0e
Fix context for beforeEach and afterEach hooks in Flow type definition file (#1344)
bd81ef4
Fix TypeScript definition for callback tests
6224f31
Set up regression testing for TypeScript
d27bc8f
Avoid MaxListenersExceededWarning in Sequence
See the full diff.
Update to this version instead 🚀
Today’s release is very exciting. After adding magic assert and snapshot testing we found that these features sometimes disagreed with each other. t.deepEqual()
would return false
, yet AVA wouldn’t show a diff. Snapshot tests cared about Set
order but t.deepEqual()
didn’t. @novemberborn came to the realization that comparing and diffing object trees, and doing so over time with snapshots, are variations on the same problem. Thus he started ConcordanceJS, a new project that lets you compare, format, diff and serialize any JavaScript value. This AVA release reaps the fruits of his labor.
Magic assert will now always show the difference between actual and expected values. If an unexpected error occurs it’ll print all (enumerable) properties of the error which can make it easier to debug your program.
More details of an object are printed, like the constructor name and the string tag. Buffers are hex-encoded with line breaks so they’re easy to read:
t.deepEqual()
improvementst.deepEqual()
and t.notDeepEqual()
now use concordance
, rather than lodash.isequal
. This changes what values AVA considers to be equal, making the t.deepEqual()
assertion more predictable. You can now trust that all aspects of your objects are compared.
Object wrappers are no longer equal. The following assertion will now fail:
t.deepEqual(Object(1), 1); // fails
For Map
and Set
objects to be equal, their elements must now be in the same order:
const actual = new Set(['hello', 'world']);
t.deepEqual(actual, new Set(['hello', 'world'])); // passes
t.deepEqual(actual, new Set(['world', 'hello']) // fails
With this release AVA will compare all enumerable properties of an object. For an array this means that the comparison considers not just the array elements. The following are no longer considered equal:
const actual = [1, 2, 3];
const expected = [1, 2, 3];
expected.also = 'a property';
t.deepEqual(actual, expected); // fails
The same goes for Map
and Set
objects, errors, and so forth:
const actual = new TypeError('Bad value');
const expected = new TypeError('Bad value');
expected.value = 41;
t.deepEqual(actual, expected); // fails
You used to be able to compare Arguments
object to an object literal:
const args = (function() { return arguments; })('hello', 'world');
t.deepEqual(args, {0: 'hello', 1: 'world'}); // now fails
Instead you must now use:
const args = (function() { return arguments; })('hello', 'world');
t.deepEqual(args, ['hello', 'world']); // passes
(Of course you can still compare Arguments
objects to each other.)
New in this release is the ability to compare React elements:
t.deepEqual(<HelloWorld/>, <HelloWorld/>);
const renderer = require('react-test-renderer');
t.deepEqual(renderer.create(<HelloWorld/>).toJSON(), <h1>Hello World</h1>);
Snapshots too now use concordance
. This means values are compared with the snapshot according to the same rules as t.deepEqual()
, albeit with some minor differences:
Argument
objects can only be compared to Argument
objectsNote that Node.js versions before 6.5 cannot infer names of all functions . AVA will pass a snapshot assertion if it determines the name information is unreliable.
AVA now saves two files when snapshotting. One, ending in the .snap
extension, contains a compressed serialization of the expected value. The other is a readable Markdown file that contains the snapshot report. You should commit both to source control. The report file can be used to see what is in your snapshots and to compare snapshot changes over time.
Try it out with our snapshot example! Or check out an example snapshot report.
The snapshot file location now follows your test layout. If you use a test
folder, they’ll be placed in test/snapshots
. With __tests__
they’ll be placed in __tests__/__snapshots__
. And if you just have a test.js
in your project root the snapshot files will be written to test.js.snap
and test.js.md
. You may have to manually remove old snapshot files after installing this new AVA version. ebd572a
Improved snapshot support in watch mode
In watch mode, AVA now watches for changes to snapshot files. This is handy when you revert changes while the watcher is running. Snapshot files are correctly tracked as test dependencies, so the right tests are rerun. Typing u
, followed by Enter
updates the snapshots in the tests that just ran. (And the watcher won’t rerun tests when snapshots are updated.) 87eef84 dbc78dc f507e36 50b60a1
AVA 0.19 already worked great with Node.js 8, and we’ve made it even better by removing unnecessary Babel transpilations in our stage-4
preset. We’re now also forwarding the --inspect-brk
flag for debugging purposes. e456951 a868b02
We’ve added new recipes and improved others:
browser-env
c01ac05--concurrency
without a value now causes AVA to exit with an error 8c35a1at.throws()
with a resolved promise now prints a helpful error message dfca2d9t.title
accessor has been documented. 549e99bWe welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
The new version differs by 63 commits.
854203a
0.20.0
652705b
Add more screenshot fixtures
9d3b1ba
Deep update of XO and its dependencies
8d09ba5
Link to ava-snapshot-example
2360256
Redo all of the screenshots
589489d
Meta tweaks
f507e36
Add command for updating snapshots in watch mode (#1413)
87eef84
Automatically watch for snapshot changes
a141033
concordance@2
f62c137
Update readme
0e82f8f
Add integration test for appending to an existing snapshot file
ebd572a
Determine snapshot directory by where the test is located
dbc78dc
Treat loaded snapshot files as test dependencies
50b60a1
Track snapshot files touched during test run, ignore in watcher
6d3c279
Include dirty sources in watcher debug output
There are 63 commits in total.
See the full diff
Update to this version instead 🚀
This is primarily a bug fix release, but some features did sneak in:
npm
2b4e35dThis release includes the following patches:
t.deepEqual()
and magic assert diffs 9e4ee3fBuffer
APIs that are unavailable in Node.js releases older than 4.5 d0fc8c9t.throws()
promise return value to be any
4a769f8test()
so macros are compatible with the latest flow-bin
e794e73We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
The new version differs by 17 commits.
a1afbe3
0.21.0
f9b865a
Update safe-buffer in package-lock.json
d0fc8c9
Avoid directly using newish Buffer APIs (#1448)
9e4ee3f
Upgrade concordance (#1450)
761f7f7
Update expected package.json version in readme (#1449)
e794e73
Resolve strict checking of function call arity (#1441)
1cbcb06
Revert "Handle package-lock.json churn"
8d981bf
Handle package-lock.json churn
c09462c
Assume npm 5.2.0 during development and CI
2b4e35d
Add an additional npm-based recipe for Jetbrains IDEs (#1444)
4a769f8
Update flow def for AssertContext.throws to match typescript def (#1443)
3f6e134
Include raw actual and expected objects in AssertionError (#1432)
0069a7e
Remove non-existent npm run script in maintaining.md (#1434)
e58e96e
Minor readme tweak (#1422)
5ae434a
Bump dependencies
There are 17 commits in total.
See the full diff
Update to this version instead 🚀
There's but a few commits in this release, but we've made a big change to how AVA manages its test workers 👩🏼‍🔬👨🏼‍đźŹđź‘¨đźŹżâ€Ťđźš€đź‘¨đźŹ»â€Ťâš•ď¸Źđź‘©đźŹ˝â€Ťđź’Ľ.
We now cap the number of concurrent workers to the number of CPU cores on your machine. Previously AVA started workers for each test file, so if you had many test files this could actually bring things to a halt. 465fcec
You can still customize the concurrency by setting the concurrency
option in AVA's package.json
configuration, or by passing the --concurrency
flag. We've also beefed up input validation on that flag. b6eef5a
Unfortunately this does change how test.only()
behaves. AVA can no longer guarantee that normal tests won't run. For now, if you want to use test.only()
, you should run tests from just that file. We have an open issue to add an --only
flag, which will ensure that AVA runs just the test.only()
tests. If you'd like to help us with that please head on over to #1472.
t.log()
We've also added t.log()
, which lets you print a log message contextually alongside the test result, instead of immediately printing it to stdout
like console.log
. 14f7095
t.notThrows()
example has been clarified 57f5007We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
The new version differs by 10 commits.
dd9e8b2
0.22.0
b6eef5a
Fail hard when --concurrency
is set to invalid values (#1478)
57f5007
Fix typo in t.notThrows
example (#1486)
d8c21a6
Update debugging with webstorm recipe (#1483)
14f7095
Implement t.log() (#1452)
e28be05
Fixed makeApp() in endpoint testing recipe (#1479)
465fcec
Limit concurrency to the number of CPU cores (#1467)
4eea226
Use --verbose when testing CLI output (#1477)
a0d5b37
Simplify readme avatar URLs
31b1380
Add tests for improper-usage-messages (#1462)
See the full diff
Version 0.19.0 of ava just got published.
The version 0.19.0 is not covered by your current version range.
Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.
I recommend you look into these changes and try to get onto the latest version of ava. Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.
Release Notes
0.19.0Since our last minor release, @novemberborn has worked tirelessly on refactoring big parts of the codebase to be more correct and readable, while squashing many bugs. We've also added multiple detections that will prevent user mistakes.
Highlights
Working snapshots
We released snapshot support with
v0.18.0
, but unfortunately it didn’t work. That’s fixed now. Since we’re usingjest-snapshot
the output will look a little different from AVA’s other assertions. Most notably the output will not be colored.57fd051
Tests fail if no assertions are run (BREAKING)
Sometimes you write a test that accidentally passes, because your assertion was never run. For example, the following test passes if
getAnimals()
returns an empty array:AVA now fails your test if no assertions were run. This can be a problem if you use third-party assertion libraries, since AVA cannot detect when those assertions pass. You can disable this behavior by setting the
failWithoutAssertions
option tofalse
in AVA'spackage.json
configuration.3a4553c
Improved
t.throws()
andt.notThrows()
assertions (BREAKING)Various improvements have been made to these assertions. Unfortunately this does include some breaking changes.
Calling these assertions with an observable or promise makes them asynchronous. You now need to
await
them:Previously, these would return a promise that was rejected if the assertion failed. This leaked AVA’s internal assertion error. Now they’ll fulfill their returned promise with
undefined
instead (d56db75). You typically won’t notice this in your test.We’ve improved how we detect when
t.throws()
andt.notThrows()
are used incorrectly (d924045). This might be when, rather than passing a function, you call it:You can now use
await
andyield
in the argument expressions (e.g.t.throws(await createThrowingFunction())
. The instructions on how to use these assertions correctly are now shown with the test failure, instead of being written to the console as your tests run.Incorrectly using these assertions now always causes your test to fail.
Stack traces are now correct, even if used asynchronously (f6a42ba). The error messages have been improved for when
t.throws()
fails to encounter an error, or ift.notThrows()
does (4463f38). Ift.notThrows()
fails, the encountered error is shown (22c93ed).Improved magic assert output
Actual and/or expected values are now included in the magic assert output, with helpful labels that are relevant to the failing assertion.
4f87f32
Detect hanging tests
AVA can now detect when an asynchronous test is hanging (880e87e).
Note that this may not work if your code is listening on a socket or is using a timer or interval.
Better Babel option resolution
We’re now resolving Babel options ahead of time, using
hullabaloo-config-manager
. This fixes long-standing issues with relative paths in AVA’s"babel"
options inpackage.json
files (#707). It also means we’re better at recompiling test and helper files if your Babel config changes or you update plugins or presets.0464b14
Miscellaneous
t.regex()
andt.notRegex()
are now validated. f062981All changes
v0.18.2…v0.19.0
Thanks
Get involved
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
Commits
The new version differs by 65 commits .
8f80ed1
0.19.0
054d39b
Fix get-port usage
affbb45
Fail tests that finish with pending assertions
2e48970
Remove unnecessary test to verify throws/notThrows return promises
d2a294d
Reword error message for when assertions are used after test has finished
ecdadfa
Improve Babel recipe (#1290)
146c3e2
Set default color config based on supports-color
2283247
Document --color CLI flag
b581983
Don't highlight formatted values with --no-color
941c42e
Bump hullabaloo-config-manager
57fd051
Make snapshots usable again
48b892a
Refactor Runner
f23c17d
Remove mention of stage-2 in readme (#1325)
d924045
Integrate with improved throws helper
5e7ea9a
Print error message before formatted assertion
There are 65 commits in total. See the full diff.
Not sure how things should work exactly?
There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html) and of course you may always [ask my humans](https://github.com/greenkeeperio/greenkeeper/issues/new).Your Greenkeeper Bot :palm_tree: