Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Update dependency ava to v0.25.0 #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Jan 29, 2018

This Pull Request updates dependency ava from v0.18.2 to v0.25.0

Release Notes

v0.19.0

Since 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 using jest-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:

test('unicorn', t => {
  for (const animal of getAnimals()) {
    t.is(animal, 'unicorn');
  }
});

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 to false in AVA's package.json configuration.

3a4553c

Improved t.throws() and t.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:

const promise = Promise.reject(new TypeError('🦄'));

test('rejects', async t => {
  await t.throws(promise);
});

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() and t.notThrows() are used incorrectly (d924045). This might be when, rather than passing a function, you call it:

test('throws', t => {
  t.throws(throwingFunction());
});

You can now use await and yield 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 if t.notThrows() does (4463f38). If t.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 in package.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
  • There is a new recipe for precompiling source files with webpack. a49f66b
  • You can now type the test context when using TypeScript. 50ad213
  • The color of text diff output has been fixed. 9f2ff09
  • Text diffs are now faster. bd5ed60
  • Values are no longer highlighted if colors are disabled. b581983
  • AVA no longer crashes if tests fail with non-errors. 157ef25
  • YAML blocks in the TAP output have been improved. 3279336
  • We’re now printing assertion statements with less depth. 0510d80
  • Arguments to t.regex() and t.notRegex() are now validated. f062981

All changes

v0.18.2…v0.19.0

Thanks

💖 Huge thanks to @​Wp1987, @​lukechilds, @​jakwuh, @​danny-andrews, @​mmkal, @​yatharthk, @​klauscfhq, @​screendriver, @​jhnns, @​danez and @​florianb for helping us with this release. We couldn’t have done it without you!

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.


v0.19.1

A bugfix release. See 0.19.0 for full release notes.

  • Prevent MaxListenersExceededWarning from being emitted if a test file contains more than 10 tests d27bc8ffbb060fa73dbcc42d548d0f95c1bc0541
  • Fix t.end() not being available in the TypeScript definition for callback tests bd81ef4a995edcf37f8f2199ac8b83c1463e3a4a
  • Fix t.context not being available in the Flow definition for beforeEach() and afterEach() hooks d169f0e7c25e861fe9221af96b883156a1749ae4

v0.20.0

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.

Highlights

More magical asserts

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.

Example of a formatted exception

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:

Example of diffed Buffers

t.deepEqual() improvements

t.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>);
Snapshot improvements

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 objects
  • Functions are compared by name and other enumerable properties
  • Promises are compared by their constructor and additional enumerable properties
  • Symbols are compared by their string serialization. Registered and well-known symbols will never equal symbols with similar descriptions

Note 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. ebd572a02debe8e17802f795e6cd618073c8d787

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.) 87eef846392d04b727b57981a16f7e8429a04195 dbc78dc19cb759b6b72946bc1b833abc284cfab2 f507e364c4be8ac0f5702b9fd31ac634b9ec35cb 50b60a11aecf9bc6945b7e836a9ec8855bbcd86e

Node.js 8 support

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. e45695197c8ba5d0ec7df7a7fe38f00f9a5f5fb0 a868b02f7cdee89d82bd22b3f4f47da2e1cba6ac

New and improved recipes

We’ve added new recipes and improved others:

Miscellaneous
  • Specifying --concurrency without a value now causes AVA to exit with an error 8c35a1a4b61c3f91d8c7b61e185dd5b450402bc0
  • Using t.throws() with a resolved promise now prints a helpful error message dfca2d9a24e7ee4a12102a8976b89380dde74d4b
  • The t.title accessor has been documented. 549e99b2bd13d88fa44306919fd66abe808e791c

All changes

v0.19.1...v0.20.0

Thanks

💖 Huge thanks to @​lukechilds, @​alexrussell, @​zs-zs, @​cncolder, @​JPeer264, @​CImrie, @​blake-newman, @​yatharthk, @​bfred-it, @​tdeschryver, @​sudo-suhas, @​dohomi, @​efegurkan and @​forresst for helping us with this release. We couldn’t have done it without you!

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.


v0.21.0

This is primarily a bug fix release, but some features did sneak in:

  • Additional arguments can be passed when profiling 05bfafeff4137e25c97f175eed1ab45d4137396d
  • Though not officially supported, AVA now works better with Wallaby.js’ diff view 3f6e134af754d5e33609e7e28ce6609b57497f13
  • Expanded the Webstorm recipe to include setup instructions using npm 2b4e35d446c2d6299c8de106a5251daaef14956c

This release includes the following patches:

  • Fixes for t.deepEqual() and magic assert diffs 9e4ee3fe690f015193e10066ec779b20fd3302f0
  • Ensure AVA doesn’t use Buffer APIs that are unavailable in Node.js releases older than 4.5 d0fc8c9c4cff6ee2728a33dd05ca7358042c51c8
  • Changed Flow typing of the t.throws() promise return value to be any 4a769f8f506638fe7ec244797a8dc3f596ac424f
  • Update Flow typing of test() so macros are compatible with the latest flow-bin e794e73e5e2588e1dd51d4638cfa9573835d7ffd

Thanks

💖 Huge thanks to @​wprater, @​HippoDippo, @​roperzh, @​ArtemGovorov, @​dancoates, @​suchmaske, @​ajtorres9 and @​guillaumevincent for helping us with this release. We couldn’t have done it without you!

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.


v0.22.0

There's but a few commits in this release, but we've made a big change to how AVA manages its test workers 👩🏼‍🔬👨🏼‍🏭👨🏿‍🚀👨🏻‍⚕️👩🏽‍💼.

Highlights

Default concurrency

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. 465fcecc9ae0d3274d4d41d3baaca241d6a40130

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. b6eef5ac30e7839371a420f17060f62f971717aa

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. 14f7095d25abc5ffbff7efd7db962eaf5e86daab

Miscellaneous
  • The WebStorm recipe has been updated with instructions on how to enable the Node.js inspector. d8c21a6b8102bcc11daacba2ea6af6f9b9713959
  • The app setup in the endpoint testing recipe has been fixed e28be05788b50b0ad81c889fa5fb6c4032c4201b
  • The t.notThrows() example has been clarified 57f50072ac37dcc62eeed391c547bf841efb6f85

All changes

v0.21.0...v0.22.0

Thanks

💖 Huge thanks to @​abouthiroppy, @​ydaniv, @​nowells, @​melisoner2006, @​clayzermk1 and @​tdeschryver for helping us with this release. We couldn’t have done it without you!

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.


v0.23.0

Highlights 🕴

NODE_ENV=test

AVA will now set process.env.NODE_ENV to 'test', as long as the NODE_ENV environment variable has not already been set. 42e7c74

Improved snapshot storage location 🗃

Snapshots are stored alongside your test files. This is great when your test file is executed directly but say if you're using TypeScript to precompile your test file AVA would store the snapshots in your build directory. In this release, if source maps are available, AVA determines the original test file location and uses that to store the snapshots.

You can also specify where snapshots are stored through the snapshotDir option in the package.json file. 7fadc34

Matching anonymous tests 🕵️

--match='*' now matches all tests, including those without a title. 1df502d

Miscellaneous 🎒

  • The verbose logger now only displays the timestamp when in watch mode 1ea758f
  • Anonymous functions are now included in stack traces c72f4f2
  • Concurrency is now capped at 2 in CI environments 3f81fc4
  • AVA no longer calls Bluebird.longStackTraces(). If you're using Bluebird you may want to call this yourself using a require script. ebf78b3 61101d9
  • There's a new recipe for endpoint testing using Mongoose c9fe8db
  • The browser testing recipe has been updated with an example of exposing global variables, such as jQuery f43d5ae
  • t.log() is now supported in the Flow and TypeScript type definitions 64b7755
  • t.title is now supported in the TypeScript type definitions 3c8b1be
  • t.snapshot() now has a better Flow type definition ded7ab8

All changes 🛋

v0.22.0...v0.23.0

Thanks 💌

💖 Huge thanks to @​anshulwadhawan, @​mliou8, @​dehbmarques, @​forivall, @​forresst, @​Couto, @​impaler, @​kristianmandrup, @​lukechilds, @​neoeno, @​jugglinmike, @​P-Seebauer, @​philippotto, @​ptim, @​rhendric, @​ntwb, @​tdeschryver, @​timothyjellison and @​zellwk for helping us with this release. We couldn’t have done it without you!

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.


v0.24.0

Highlights 💡

This is a pretty small release, but a great one if you're solely developing for Node.js 8.3 or above.

You can now use object rest/spread properties in test files without any further Babel configuration. Note that if you're running tests on older versions of Node.js you'll still need to add the relevant Babel plugins, since this new language feature has not yet reached stage 4. 37c9122c50722b06039f1cc2306a7c176fd3c786

Miscellaneous 🕯

  • Before and after hooks are no longer run when all tests are skipped 1cd3a04fbab2787a4f2dd4020529f8598ec31e51
  • Improved output of assertion statements when tests fail 37e8b49af78dc72bbf6a4ff674650cd57f48ea58
  • Improved feedback when t.is() values are deeply equal but not the same c41b2afc201118bfdc4d2039180ae2ddd0f697c9
  • Updated the Typescript with an example of how to title macros f98a8810de770c4d22d87302580eecc228c8d052

All changes 📚

v0.23.0...v0.24.0

Thanks 💌

💖 Huge thanks to @​jedmao, @​Lifeuser, @​mightyiam, @​ahmadawais and @​codeslikejaggars for helping us with this release. We couldn’t have done it without you!

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.


v0.25.0

Another small release while we're gearing up for a 1.0 built with Babel 7. This is likely to be the last 0. release, but we may go through a few beta releases for 1.0 whilst we wait for Babel 7 to get out of beta itself.

  • We now detect @std/esm in AVA's "require" configuration and will use it to require subsequent modules 72c53be
  • t.log() now supports multiple arguments 4f896c2
  • AVA no longer globally modifies Error.stackTraceLimit in the worker processes f00f3c4
  • We've improved TypeScript typings for t.snapshot(value, options) 29e5dfd
  • Source maps for the test files can now be resolved if they reside on a different drive aaddc37
  • Code excerpts shown for test failures now handle Windows-style linebreaks 947f207
  • We've updated the Debugging tests with Visual Studio Code recipe with tips on serial debugging and skipping dependencies 4a13966 bcb77fc

All changes 📚

v0.24.0...v0.25.0

Thanks 💌

💖 Huge thanks to @​ppatel221, @​cdaringe, @​jy95, @​jamestalmage, @​okyantoro, @​ajafff, @​niftylettuce, @​kugtong33, @​troysandal, @​willnode and @​forresst for helping us with this release. We couldn’t have done it without you!

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

v0.23.0

  • eebf26e Add Awesome mentioned badge
  • c72f4f2 Include anonymous functions in stacktraces (#​1508)
  • 1ea758f Only display timestamp in verbose logger if watch mode is active (#​1557)
  • 1cb9d4f Adjust NODE_PATH test to fix linting issue
  • 3f81fc4 Limit concurrency to 2 in a CI environment
  • 3b81e2c 0.23.0

v0.24.0

  • 37e8b49 Use babel-generator to regenerate enhanced assertion statements
  • 035fd31 Verify package-lock when linting
  • 37c9122 Include syntax-object-rest-spread in default Babel options for Node.js >= 8.3.0
  • b3c4090 Fix broken link in contributing guide
  • f98a881 Document how to title macros when using TypeScript
  • 1cd3a04 Don't run before and after hooks when all tests are skipped
  • c41b2af Provide feedback when t.is() values are deeply equal but not the same
  • cb1c3f7 Fix documentation of snapshotDir option
  • efc3b31 Code style tweaks
  • f2979a3 Bump dependencies
  • 8141395 Churn and dedupe package-lock
  • e401bd1 0.24.0

v0.25.0

  • 4124d77 Update npm, test Node.js 9, detect package-lock churn in CI (#​1601)
  • 965cbc6 Use supertap to generate TAP output (#​1610)
  • 4e8f827 Switch time-require to @​ladjs/time-require
  • c1faf95 Fix typo in precompiling-with-webpack.md (#​1625)
  • 29e5dfd Add TS types for t.snapshot(content, options)
  • 72c53be support @​std/esm (#​1618)
  • aaddc37 Use absolute source map paths in precompiled files
  • 4a13966 Debug serially in the "Debugging tests with VS Code" recipe (#​1634)
  • 947f207 Update code-excerpt to ^2.1.1
  • cd8c91b Add more clarification for different Babel config in .babelrc.md (#​1642)
  • bcb77fc Recommend skipFiles for VSCode debugging
  • c2b42ec Mention #​1319 as a pitfall
  • f00f3c4 Don't set Error.stackTraceLimit in worker processes
  • 4f896c2 Make t.log() behave more like console.log()
  • a051d3e 0.25.0

This PR has been generated by Renovate Bot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant