如何使用 sdk 中的 flutter_test 和包测试?什么版本的测试使用 test_api 0.4.3?
how can I use flutter_test from sdk and the package test? what version of test uses test_api 0.4.3?
我正在尝试 运行 对我的 flutter 应用进行一些基本的单元测试。但是当我 运行 pub get 时,在我的 pubspec:
中包含 test: 1.20.0 后出现以下错误
dev_dependencies:
dependency_validator: ^3.1.0 # run flutter pub run dependency_validator
#integration_test:
# sdk: flutter
flutter_test:
sdk: flutter
test: ^1.20.0
所以当我 运行 f pub get
我看到:
Because test >=1.20.0 depends on test_api 0.4.9 and every version of flutter_test from sdk depends on test_api 0.4.3, test >=1.20.0 is incompatible with flutter_test from sdk.
So, because myapp depends on both flutter_test from sdk and test ^1.20.0, version solving failed.
pub get failed (1; So, because myapp depends on both flutter_test from sdk and test ^1.20.0, version solving failed.)```
What version of test uses test_api 0.4.3?
我可以直接使用 import 'package:flutter_test/flutter_test.dart';而不是直接从我的测试文件中的测试包导入。所以我不需要在我的 pubspec 中包含 test: 1.20.0。
尝试在您的 pubspec.yaml 文件中将 test_api 覆盖为 0.4.9:
dependency_overrides:
test_api: 0.4.9
或
dependency_overrides:
analyzer: ^3.0.0
你可以在下次 flutter 更新时删除它。
我正在尝试 运行 对我的 flutter 应用进行一些基本的单元测试。但是当我 运行 pub get 时,在我的 pubspec:
中包含 test: 1.20.0 后出现以下错误dev_dependencies:
dependency_validator: ^3.1.0 # run flutter pub run dependency_validator
#integration_test:
# sdk: flutter
flutter_test:
sdk: flutter
test: ^1.20.0
所以当我 运行 f pub get
我看到:
Because test >=1.20.0 depends on test_api 0.4.9 and every version of flutter_test from sdk depends on test_api 0.4.3, test >=1.20.0 is incompatible with flutter_test from sdk.
So, because myapp depends on both flutter_test from sdk and test ^1.20.0, version solving failed.
pub get failed (1; So, because myapp depends on both flutter_test from sdk and test ^1.20.0, version solving failed.)```
What version of test uses test_api 0.4.3?
我可以直接使用 import 'package:flutter_test/flutter_test.dart';而不是直接从我的测试文件中的测试包导入。所以我不需要在我的 pubspec 中包含 test: 1.20.0。
尝试在您的 pubspec.yaml 文件中将 test_api 覆盖为 0.4.9:
dependency_overrides:
test_api: 0.4.9
或
dependency_overrides:
analyzer: ^3.0.0
你可以在下次 flutter 更新时删除它。