Upgrading test 0.12 to 1
Breaking0.12.42 → 1.33.0Breaking12Security4Platform7Deprecated5New49Changed136Fixed86Other16
SecurityUses a redirect html file for browser tests to avoid leaking websocket details through process starting arguments.Advisory ↗
BreakingUpgrade verdict
12 breaking changes and 7 platform requirement changes and 4 security fixes.
In plain terms
- The --pub-serve flag no longer works; file an issue if you still need it.
- Tests can no longer be run in Internet Explorer.
- The command line option for specifying the dart2js path no longer exists.
- PhantomJS is no longer supported at all.
Must act Top 5 of 28 that need code or config changes
Dart SDK requirement changed in 1.31.2: >=2.0.0-dev.54.0 <2.0.0 → ^3.11.0.
What you must change
Breaking12
Drops support for the long-untested
--pub-serve option.--pub-serveFully removes support for Internet Explorer.
Drops the
dart2js-path command line argument.dart2js-pathRemoves
phantomjs support completely, which was previously broken.phantomjsPotentially breaking bug fix: ordering matchers no longer treat partially ordered objects such as NaN as fully ordered.
greaterThanChanges the return type of the body callback argument to group from dynamic to void, which may surface callbacks that erroneously return a value.
groupbodyRemoves the
experimental-chrome-wasm platform in favor of -p chrome -c dart2wasm.experimental-chrome-wasm-p chrome-c dart2wasmMakes the annotation classes OnPlatform, Retry, Skip, Tags, TestOn and Timeout final.
OnPlatformRetrySkipTagsTestOnTimeoutPrecompiled browser tests stop serving files from outside the precompiled root directory, restoring path-containment parity with dart2js and dart2wasm.
serveFilesOutsidePathBrowser tests now report the host OS instead of "none", so OS-based configuration and skips also apply to browser tests.
Requires a function definition named main directly in a test suite and gives a clearer error message than a failing compiler output.
mainFixes stringContainsInOrder to account for repetitions and empty strings, which may break some existing tests.
stringContainsInOrderSecurity4
Uses a redirect html file for browser tests to avoid leaking websocket details through process starting arguments.
Migrates out-of-process VM test communication from TCP sockets to Unix domain sockets in a restricted temporary directory.
Passes Node.js test process connection configuration and secret token via a restricted temporary authentication file.
Node.jsUses secure random values for URL secrets.
Platform7
Requires Dart 3.7.
Drops support for null unsafe Dart and bumps the SDK constraint to 3.0.0.
Requires Dart 2.18.0 or later.
Bumps the minimum Dart SDK to 2.4.0 for safer usage of for-loop elements.
Requires Dart SDK >=2.1.0.
Requires Dart 3.3.
Requires Dart 3.5.
Deprecations to plan for
Deprecated5
Adds @doNotSubmit to test(solo: ...) and group(solo: ...), so solo usage now fails under dart analyze --fatal-infos.
@doNotSubmittest()group()soloDeprecates
--use-data-isolate-strategy, now an alias for -c vm:source.--use-data-isolate-strategy-c vm:sourceDeprecates
throwsNullThrownError in favor of throwsA(isA<TypeError>()), with the implementation changed to ease migrations.throwsNullThrownErrorthrowsA()isA()TypeErrorDeprecates
throwsCyclicInitializationError and replaces its implementation with Throws(TypeMatcher<Error>()) since that exception no longer exists.throwsCyclicInitializationErrorThrows()TypeMatcherErrorDeprecates
PhantomJS and warns when it is used; support will be removed in version 2.0.0.PhantomJSAPI changes
Generated by DepDelta from published Dart source. Not mixed with prose notes.
- changed:
function internalBootstrapBrowserTest(Function getMain()): void → function internalBootstrapBrowserTest( Function Function() getMain, { StreamChannel<Object?>? testChannel, }): void
- changed:
function internalBootstrapNodeTest(Function getMain()): void → function internalBootstrapNodeTest(Function Function() getMain): void
- removed:
function internalBootstrapVmTest(Function getMain(), SendPort sendPort): void
- removed:
class OnPlatform - removed:
class Retry - removed:
class Skip - removed:
class StreamMatcher: abstract extends Matcher - removed:
class Tags - removed:
class TestFailure - removed:
class TestOn - removed:
class Throws extends AsyncMatcher - removed:
class Timeout - removed:
ctor OnPlatform(this.annotationsByPlatform) - removed:
ctor Retry(this.count) - removed:
ctor Skip([this.reason]) - removed:
ctor StreamMatcher( Future<String> matchQueue(StreamQueue queue), String description) - removed:
ctor Tags(this._tags) - removed:
ctor TestFailure(this.message) - removed:
ctor TestOn(this.expression) - removed:
ctor Throws([Matcher matcher]) - removed:
ctor Timeout(this.duration) - removed:
ctor Timeout.factor(this.scaleFactor) - removed:
ctor Timeout.parse(String timeout) - removed:
field OnPlatform.annotationsByPlatform: final Map<String, dynamic> - removed:
field Retry.count: final int - removed:
field Skip.reason: final String - removed:
field TestFailure.message: final String - removed:
field TestOn.expression: final String - removed:
field Timeout.duration: final Duration - removed:
field Timeout.scaleFactor: final num - removed:
function Function( [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]): Null - removed:
function addTearDown(callback()): void - removed:
function completion(matcher, [@deprecated String description]): Matcher - removed:
function emits(matcher): StreamMatcher - removed:
function emitsAnyOf(Iterable matchers): StreamMatcher - removed:
function emitsError(matcher): StreamMatcher - removed:
function emitsInAnyOrder(Iterable matchers): StreamMatcher - removed:
function emitsInOrder(Iterable matchers): StreamMatcher - removed:
function emitsThrough(matcher): StreamMatcher - removed:
function expect(actual, matcher, {String reason, skip, @Deprecated("Will be removed in 0.13.0.") bool verbose = …, @Deprecated("Will be removed in 0.13.0.") ErrorFormatter formatter}): void - removed:
function expectAsync(Function callback, {int count = …, int max = …, String id, String reason}): Function - removed:
function expectAsync0<T>(T callback(), {int count = …, int max = …, String id, String reason}): Func0<T> - removed:
function expectAsync1<T, A>(T callback(A a), {int count = …, int max = …, String id, String reason}): Func1<T, A> - removed:
function expectAsync2<T, A, B>(T callback(A a, B b), {int count = …, int max = …, String id, String reason}): Func2<T, A, B> - removed:
function expectAsync3<T, A, B, C>(T callback(A a, B b, C c), {int count = …, int max = …, String id, String reason}): Func3<T, A, B, C> - removed:
function expectAsync4<T, A, B, C, D>(T callback(A a, B b, C c, D d), {int count = …, int max = …, String id, String reason}): Func4<T, A, B, C, D> - removed:
function expectAsync5<T, A, B, C, D, E>( T callback(A a, B b, C c, D d, E e), {int count = …, int max = …, String id, String reason}): Func5<T, A, B, C, D, E> - removed:
function expectAsync6<T, A, B, C, D, E, F>( T callback(A a, B b, C c, D d, E e, F f), {int count = …, int max = …, String id, String reason}): Func6<T, A, B, C, D, E, F> - removed:
function expectAsyncUntil(Function callback, bool isDone(), {String id, String reason}): Function - removed:
function expectAsyncUntil0<T>(T callback(), bool isDone(), {String id, String reason}): Func0<T> - removed:
function expectAsyncUntil1<T, A>(T callback(A a), bool isDone(), {String id, String reason}): Func1<T, A> - removed:
function expectAsyncUntil2<T, A, B>(T callback(A a, B b), bool isDone(), {String id, String reason}): Func2<T, A, B> - removed:
function expectAsyncUntil3<T, A, B, C>( T callback(A a, B b, C c), bool isDone(), {String id, String reason}): Func3<T, A, B, C> - removed:
function expectAsyncUntil4<T, A, B, C, D>( T callback(A a, B b, C c, D d), bool isDone(), {String id, String reason}): Func4<T, A, B, C, D> - removed:
function expectAsyncUntil5<T, A, B, C, D, E>( T callback(A a, B b, C c, D d, E e), bool isDone(), {String id, String reason}): Func5<T, A, B, C, D, E> - removed:
function expectAsyncUntil6<T, A, B, C, D, E, F>( T callback(A a, B b, C c, D d, E e, F f), bool isDone(), {String id, String reason}): Func6<T, A, B, C, D, E, F> - removed:
function expectLater(actual, matcher, {String reason, skip}): Future - removed:
function fail(String message): Null - removed:
function group(description, body(), {String testOn, Timeout timeout, skip, tags, Map<String, dynamic> onPlatform, int retry, @deprecated bool solo = …}): void - removed:
function mayEmit(matcher): StreamMatcher - removed:
function mayEmitMultiple(matcher): StreamMatcher - removed:
function neverEmits(matcher): StreamMatcher - removed:
function printOnFailure(String message): void - removed:
function prints(matcher): Matcher - removed:
function pumpEventQueue({int times}): Future - removed:
function registerException(error, [StackTrace stackTrace]): void - removed:
function setUp(callback()): void - removed:
function setUpAll(callback()): void - removed:
function spawnHybridCode(String dartCode, {Object message, bool stayAlive = …}): StreamChannel - removed:
function spawnHybridUri(uri, {Object message, bool stayAlive = …}): StreamChannel - removed:
function tearDown(callback()): void - removed:
function tearDownAll(callback()): void - removed:
function test(description, body(), {String testOn, Timeout timeout, skip, tags, Map<String, dynamic> onPlatform, int retry, @deprecated bool solo = …}): void - removed:
function throwsA(matcher): Matcher - removed:
get StreamMatcher.description: String - removed:
get Tags.tags: Set<String> - removed:
get Timeout.hashCode: int - removed:
method StreamMatcher.matchQueue(StreamQueue queue): Future<String> - removed:
method TestFailure.toString(): String - removed:
method Throws.describe(Description description): Description - removed:
method Throws.matchAsync(item) - removed:
method Timeout.apply(Duration base): Duration - removed:
method Timeout.merge(Timeout other): Timeout - removed:
method Timeout.operator ==(other): bool - removed:
method Timeout.toString(): String - removed:
static field Timeout.none: const - removed:
typedef String ErrorFormatter( actual, Matcher matcher, String reason, Map matchState, bool verbose) - removed:
typedef T Func0<T>() - removed:
typedef T Func1<T, A>([A a]) - removed:
typedef T Func2<T, A, B>([A a, B b]) - removed:
typedef T Func3<T, A, B, C>([A a, B b, C c]) - removed:
typedef T Func4<T, A, B, C, D>([A a, B b, C c, D d]) - removed:
typedef T Func5<T, A, B, C, D, E>([A a, B b, C c, D d, E e]) - removed:
typedef T Func6<T, A, B, C, D, E, F>([A a, B b, C c, D d, E e, F f]) - removed:
variable completes: final Matcher - removed:
variable doesNotComplete: final Matcher - removed:
variable emitsDone: final - removed:
variable throws: const Matcher - removed:
variable throwsArgumentError: const Matcher - removed:
variable throwsConcurrentModificationError: const Matcher - removed:
variable throwsCyclicInitializationError: const Matcher - removed:
variable throwsException: const Matcher - removed:
variable throwsFormatException: const Matcher - removed:
variable throwsNoSuchMethodError: const Matcher - removed:
variable throwsNullThrownError: const Matcher - removed:
variable throwsRangeError: const Matcher - removed:
variable throwsStateError: const Matcher - removed:
variable throwsUnimplementedError: const Matcher - removed:
variable throwsUnsupportedError: const Matcher - removed:
variable })): final