Fix missing test locations on solo-skipped tests by passing location/trace through (#2600) Fixes https://github.com/dart-lang/test/issues/2599 by ensuring stack traces/locations are carried across when tests are replaced with skips because of `solo`. Since `test_api` 0.7.9 has already been published, I bumped this to `0.7.10`, which also meant updating in `test` and `test_core` for things to resolve correctly. I'm not sure if I did this correctly, so if I need to change anything, please let me know! - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR.
diff --git a/pkgs/test/CHANGELOG.md b/pkgs/test/CHANGELOG.md index 4adfc80..d851649 100644 --- a/pkgs/test/CHANGELOG.md +++ b/pkgs/test/CHANGELOG.md
@@ -5,6 +5,8 @@ * Remove the default 12 minute timeout to compile and load test suites. * Bump `test_core` to 0.6.16 * Add comments to the top-level libraries in the package. +* Bump `test_api` to 0.7.10 to fix missing locations on tests skipped due to + the use of `solo`. ## 1.29.0
diff --git a/pkgs/test/pubspec.yaml b/pkgs/test/pubspec.yaml index a26f02c..685bc56 100644 --- a/pkgs/test/pubspec.yaml +++ b/pkgs/test/pubspec.yaml
@@ -35,7 +35,7 @@ stream_channel: ^2.1.0 # Use an exact version until the test_api and test_core package are stable. - test_api: 0.7.9 + test_api: 0.7.10-wip test_core: 0.6.16-wip typed_data: ^1.3.0
diff --git a/pkgs/test/test/runner/json_reporter_test.dart b/pkgs/test/test/runner/json_reporter_test.dart index 580eacf..b01c394 100644 --- a/pkgs/test/test/runner/json_reporter_test.dart +++ b/pkgs/test/test/runner/json_reporter_test.dart
@@ -422,6 +422,36 @@ ); }); + test('reports skipped tests due to solo', () { + const reason = 'does not have "solo"'; + return _expectReport( + ''' + test('skip 1', () {}); + test('solo 2', () {}, solo: true); + test('skip 3', () {}); + ''', + [ + [ + suiteJson(0), + testStartJson(1, 'loading test.dart', groupIDs: []), + testDoneJson(1, hidden: true), + ], + [ + groupJson(2, testCount: 3), + testStartJson(3, 'skip 1', skip: reason, line: 6, column: 9), + printJson(3, 'Skip: $reason', type: 'skip'), + testDoneJson(3, skipped: true), + testStartJson(4, 'solo 2', skip: false, line: 7, column: 9), + testDoneJson(4, skipped: false), + testStartJson(5, 'skip 3', skip: reason, line: 8, column: 9), + printJson(5, 'Skip: $reason', type: 'skip'), + testDoneJson(5, skipped: true), + ], + ], + doneJson(), + ); + }); + test('reports skipped groups', () { return _expectReport( '''
diff --git a/pkgs/test_api/CHANGELOG.md b/pkgs/test_api/CHANGELOG.md index b47ae6f..69a752a 100644 --- a/pkgs/test_api/CHANGELOG.md +++ b/pkgs/test_api/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 0.7.10-wip + +* Fix missing locations on tests skipped due to the use of `solo`. + ## 0.7.9 * Allow `analyzer` major version 10.
diff --git a/pkgs/test_api/lib/src/backend/declarer.dart b/pkgs/test_api/lib/src/backend/declarer.dart index c7ea601..97c1294 100644 --- a/pkgs/test_api/lib/src/backend/declarer.dart +++ b/pkgs/test_api/lib/src/backend/declarer.dart
@@ -386,6 +386,8 @@ skip: true, skipReason: 'does not have "solo"', ), + trace: entry.trace, + location: entry.location, () {}, ); }
diff --git a/pkgs/test_api/pubspec.yaml b/pkgs/test_api/pubspec.yaml index 5d68a60..952ff45 100644 --- a/pkgs/test_api/pubspec.yaml +++ b/pkgs/test_api/pubspec.yaml
@@ -1,5 +1,5 @@ name: test_api -version: 0.7.9 +version: 0.7.10-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
diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md index 593706f..48af67b 100644 --- a/pkgs/test_core/CHANGELOG.md +++ b/pkgs/test_core/CHANGELOG.md
@@ -3,6 +3,7 @@ - Fix coverage reporting to report all coverage when using JSON workflow. * Add `SuiteConfiguration.suiteLoadTimeout` to configure the timeout for loading a test suite. * Removed hard-coded timeout of 12m for loading a test suite and set default to `none`. +* Bump `test_api` to 0.7.10 ## 0.6.15
diff --git a/pkgs/test_core/pubspec.yaml b/pkgs/test_core/pubspec.yaml index 0da62e9..dd6bff8 100644 --- a/pkgs/test_core/pubspec.yaml +++ b/pkgs/test_core/pubspec.yaml
@@ -28,7 +28,7 @@ stack_trace: ^1.10.0 stream_channel: ^2.1.0 # Use an exact version until the test_api package is stable. - test_api: 0.7.9 + test_api: 0.7.10-wip vm_service: '>=6.0.0 <16.0.0' yaml: ^3.0.0