I am in the middle of rewriting the testing chapter in Dart for Hipsters which reminded me that I need update a couple of my packages in the Dart Pub. The unittest library is being moved out of the Dart SDK proper and into a pub-hosted library.
For the dart dirty, this involves changing my only dependency to point to any (e.g. the latest) version of the pub-hosted version of unittest:
name: dirty version: 0.0.2 description: Dart Dirty is a persistent, server-side HashMap - a dirt simple nosql DB. author: Chris Strom <firstname.lastname@example.org> homepage: https://github.com/eee-c/dart-dirty dependencies: unittest: anyAfter running a
pub update, I can again run the test suite and... everything is still passing:
➜ dart-dirty git:(master) ✗ dart test/dirty_test.dart unittest-suite-wait-for-done PASS: new DBs creates a new DB PASS: writing can write a record to the DB PASS: reading can read a record from the DB PASS: reading can read a record from the DB stored on the filesystem PASS: removing can remove a record from the DB PASS: removing can remove keys from the DB PASS: removing can remove a record from the filesystem store PASS: removing removes from the list of keys in the filesystem store All 8 tests passed. unittest-suite-successEasy enough. I switch my attention instead to Hipster MVC. After updating
pubspec.yamlin this project as well, I run the test suite. The test suite is browser-based, and unlike the command-line test suite, this one fails rather spectacularly:
Exception: NoSuchMethodError : method not found: 'set:innerHtml' Receiver: Instance of 'StyleElement' ...That worked just fine before upgrading. I wonder why setting the contents of the style element would not work. Perhaps I just need to try a newer version of Dartium—the test suite itself still passes if I remove the enhanced HTML reporter:
unittest-suite-wait-for-done PASS: HipsterCollection has multiple models PASS: HipsterCollection lookup works by ID PASS: HipsterCollection lookup is null when it does not hold ID PASS: HipsterCollection fetch() fails without a url PASS: HipsterCollection fetch() callback is invoked PASS: HipsterCollection fetch() callback dispatches a load event PASS: HipsterCollection add dispatch add event All 7 tests passed. unittest-suite-successAnd that turns out to be the entirety of the problem. After downloading the latest canary build of Dartium, I reload my test and everything is again working:
With that, I can switch back to rewriting my testing chapter—safe in the knowledge that I can tell readers to use the dart pub version of unittest and have everything work. I was a bit worried for a bit, but it was nothing that a quick update couldn't solve.