Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove test_api copies of scaffolding functions #2030

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/test/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies:
stream_channel: ^2.1.0

# Use an exact version until the test_api and test_core package are stable.
test_api: 0.6.1
test_api: 0.7.0
test_core: 0.5.5

typed_data: ^1.3.0
Expand Down
6 changes: 6 additions & 0 deletions pkgs/test_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.7.0-wip

* Remove the definitions of `group`, `test`, `setUp`, `tearDown`, `setUpAll`,
and `tearDownAll`. These methods are available in `package:test_core` and
re-exported in `package:test`.

## 0.6.1

* Drop support for null unsafe Dart, bump SDK constraint to `3.0.0`.
Expand Down
9 changes: 6 additions & 3 deletions pkgs/test_api/lib/scaffolding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export 'src/backend/configuration/tags.dart' show Tags;
export 'src/backend/configuration/test_on.dart' show TestOn;
export 'src/backend/configuration/timeout.dart' show Timeout;
export 'src/scaffolding/spawn_hybrid.dart' show spawnHybridCode, spawnHybridUri;
export 'src/scaffolding/test_structure.dart'
show addTearDown, group, setUp, setUpAll, tearDown, tearDownAll, test;
export 'src/scaffolding/utils.dart'
show markTestSkipped, printOnFailure, pumpEventQueue, registerException;
show
addTearDown,
markTestSkipped,
printOnFailure,
pumpEventQueue,
registerException;
2 changes: 1 addition & 1 deletion pkgs/test_api/lib/src/scaffolding/spawn_hybrid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:stream_channel/stream_channel.dart';

import '../backend/remote_exception.dart';
import '../utils.dart';
import 'test_structure.dart' show addTearDown;
import 'utils.dart' show addTearDown;

/// A transformer that handles messages from the spawned isolate and ensures
/// that messages sent to it are JSON-encodable.
Expand Down
249 changes: 0 additions & 249 deletions pkgs/test_api/lib/src/scaffolding/test_structure.dart

This file was deleted.

15 changes: 15 additions & 0 deletions pkgs/test_api/lib/src/scaffolding/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ void printOnFailure(String message) {
_currentInvoker.printOnFailure(message);
}

/// Registers a function to be run after the current test.
///
/// This is called within a running test, and adds a tear-down only for the
/// current test. It allows testing libraries to add cleanup logic as soon as
/// there's something to clean up.
///
/// The [callback] is run before any callbacks registered with [tearDown]. Like
/// [tearDown], the most recently registered callback is run first.
///
/// If this is called from within a [setUpAll] or [tearDownAll] callback, it
/// instead runs the function after *all* tests in the current test suite.
void addTearDown(dynamic Function() callback) {
_currentInvoker.addTearDown(callback);
}

/// Marks the current test as skipped.
///
/// A skipped test may still fail if any exception is thrown, including uncaught
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test_api/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test_api
version: 0.6.1
version: 0.7.0-wip
description: >-
The user facing API for structuring Dart tests and checking expectations.
repository: https://github.com/dart-lang/test/tree/master/pkgs/test_api
Expand Down
1 change: 1 addition & 0 deletions pkgs/test_api/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dependency_overrides:
path: ../test
test_core:
path: ../test_core
matcher: any
15 changes: 14 additions & 1 deletion pkgs/test_core/lib/scaffolding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@ import 'src/util/print_sink.dart';
// This file is an almost direct copy of import below, but with the global
// declarer added.
export 'package:test_api/scaffolding.dart'
hide group, setUp, setUpAll, tearDown, tearDownAll, test;
show
OnPlatform,
Retry,
Skip,
Tags,
TestOn,
Timeout,
addTearDown,
markTestSkipped,
printOnFailure,
pumpEventQueue,
registerException,
spawnHybridCode,
spawnHybridUri;

/// The global declarer.
///
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
stack_trace: ^1.10.0
stream_channel: ^2.1.0
# Use an exact version until the test_api package is stable.
test_api: 0.6.1
test_api: 0.7.0
vm_service: ">=6.0.0 <12.0.0"
yaml: ^3.0.0

Expand Down