Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Update ava to the latest version 🚀 #191

Closed
wants to merge 1 commit into from

Conversation

greenkeeper[bot]
Copy link

@greenkeeper greenkeeper bot commented Jun 28, 2017

Version 0.20.0 of ava just got published.

Dependency ava
Current Version 0.19.1
Type devDependency

The version 0.20.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.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. 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

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. e456951 a868b02

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 8c35a1a
  • Using t.throws() with a resolved promise now prints a helpful error message dfca2d9
  • The t.title accessor has been documented. 549e99b

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.

Commits

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

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

@codecov
Copy link

codecov bot commented Jun 28, 2017

Codecov Report

Merging #191 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #191   +/-   ##
=======================================
  Coverage   92.94%   92.94%           
=======================================
  Files           9        9           
  Lines         241      241           
=======================================
  Hits          224      224           
  Misses         17       17

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a16058f...4854d01. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.62% when pulling 4854d01 on greenkeeper/ava-0.20.0 into a16058f on master.

greenkeeper bot added a commit that referenced this pull request Jul 13, 2017
@greenkeeper
Copy link
Author

greenkeeper bot commented Jul 13, 2017

Version 0.21.0 just got published.

Update to this version instead 🚀

Release Notes 0.21.0

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

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

This release includes the following patches:

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

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.

Commits

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

greenkeeper bot added a commit that referenced this pull request Aug 15, 2017
@greenkeeper
Copy link
Author

greenkeeper bot commented Aug 15, 2017

Version 0.22.0 just got published.

Update to this version instead 🚀

Release Notes 0.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. 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

Miscellaneous

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.

Commits

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

@stale
Copy link

stale bot commented Oct 14, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 14, 2017
greenkeeper bot added a commit that referenced this pull request Oct 24, 2017
@greenkeeper
Copy link
Author

greenkeeper bot commented Oct 24, 2017

Version 0.23.0 just got published.

Update to this version instead 🚀

Release Notes 0.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 snapshotLocation 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.

Commits

The new version differs by 30 commits.

  • 3b81e2c 0.23.0
  • 3f81fc4 Limit concurrency to 2 in a CI environment
  • 1cb9d4f Adjust NODE_PATH test to fix linting issue
  • 1ea758f Only display timestamp in verbose logger if watch mode is active (#1557)
  • c72f4f2 Include anonymous functions in stacktraces (#1508)
  • eebf26e Add Awesome mentioned badge
  • f43d5ae Recipe instructions for making jQuery available in browser (#1543)
  • 68ce4b8 Update tsconfig.json docs link in the TS recipe
  • 837b0dd Fix TypeScript recipe typo (#1549)
  • 2349316 Update package-lock with changes in #1407
  • bb91862 Version warning when local version is behind (#1407)
  • 42e7c74 Set NODE_ENV to to 'test' if not already set (#1523)
  • 64b7755 Add t.log() for Flow and TypeScript (#1538)
  • 8955e15 Lint test fixtures
  • fa4f73c Update to npm@5.4.2

There are 30 commits in total.

See the full diff

@stale stale bot closed this Nov 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant