I have a dart project that has several tests, when I try to run an isolated test I get this warning:
Warning: A tag was used that wasn't specified in dart_test.yaml. "tagName" was used in the suite itself
how should i declare these tags correctly in dart_test.yaml?
CodePudding user response:
Steps
- Create a file
dart_test.yaml
at the root of your project - Add your tags one after another under a
tags
field - Add tags to your
test
ortestWidget
declaration - Run your tests with the
-t
flag followed by the wanted tag
Sample
Let's say I want to add the following tags: golden, atom, molecule, organism, mobile, desktop. My dart_test.yaml
will look like this:
tags:
golden:
atom:
molecule:
organism:
mobile:
desktop:
And everything should be okay you can write your test:
void main() {
testWidgets(
'this is a test',
(tester) async {
// ...
},
tags: ['atom', 'mobile'],
);
}
You can run it with the following command:
$ flutter test -t mobile