Test runner doesn't use experiments in analysis_options.yaml
See original GitHub issueMCVE
lib/foo.dart
typedef Foo = String;
Foo foo(){
return 'foo';
}
test/foo_test.dart
import 'package:dart_code_3243/foo.dart';
import 'package:test/test.dart';
void main() {
test('foo', () {
expect(foo(), equals('foo'));
});
}
analysis_options.yaml
include: package:pedantic/analysis_options.yaml
analyzer:
enable-experiment:
- nonfunction-type-aliases
pubspec.yaml
name: dart_code_3243
description: An MCVE for Dart-Code/Dart-Code issue 3243.
environment:
sdk: ">=2.13.0-0 <3.0.0"
dev_dependencies:
pedantic: ^1.9.0
test: ^1.16.8
Error message when clicking run tests button
Failed to load "test/foo_test.dart":
Unable to spawn isolate: lib/foo.dart:1:13: Error: Can't create typedef from non-function type.
typedef Foo = String;
Expected:
it uses analysis_options.yaml
to enable experiments.
Request for clarification
Is this intended behavior? Is there any way to enable experiments across all of Dart-Code’s features including running/debugging/analyzing/testing?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Customizing static analysis - Dart
Static analysis allows you to find problems before executing a single line of code. It's a powerful tool used to prevent bugs and...
Read more >Flutter linter rules and structure in analysis_options.yaml file
I have been looking off and on for a few days now and I'm trying to customize the rules for linting my flutter...
Read more >Dart Linting Tutorial – Healthy Flutter Codebase ... - Reso Coder
All we need to do is to edit a file called analysis_options.yaml. New Flutter projects currently don't come with this file pre-created, ...
Read more >testfairy - Dart API docs - Pub.dev
Make sure your project root has an analysis_options.yaml that looks similar to this. The important part is the enabled experiment in the top...
Read more >Introducing package:flutter_lints - Flutter documentation
yaml that was used by the dart analyzer to identify code issues if a Flutter project didn't define a custom analysis_options.yaml file. Since ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes that is correct. We don’t want to make the compilers have to look for and read analysis_options.yaml, so I don’t think we would go this route. The experiment flags are intentionally somewhat manual to use, but there has been some discussion of ways to make trying out experimental features and providing feedback easier (without giving up our ability to make breaking changes to experimental features). I think @jakemac53 may have had some ideas there that might be worth revisiting at some point.
I think this expected - the experiment is only read by the analyzer, not the VM when you run the code.
I don’t know if there’s a single way you can enable this for both - perhaps @leafpetersen or @mit-mit may know?