Skip to content

Commit 0134ff0

Browse files
quirijnAtPropertyMeQuirijnGB
authored andcommitted
Add test command
1 parent 526884f commit 0134ff0

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ uni pub global activate uni
4646
- [ ] `uni migrate`: Perform a null safety migration on a project or package.
4747
- [x] `uni pub`: Work with packages.
4848
- [ ] `uni run`: Run the program.
49-
- [ ] `uni test`: Run tests in this package.
49+
- [x] `uni test`: Run tests in this package.
5050

5151
#### Tooling
5252
Based on context `uni` chooses the appropriate tooling. This behavior can be overriden, by setting `--tooling` flag.

bin/uni.dart

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void main(List<String> arguments) async {
3232
runner.addCommand(PubCommand());
3333
runner.addCommand(AnalyzeCommand());
3434
runner.addCommand(FormatCommand());
35+
runner.addCommand(TestCommand());
3536

3637
await runner.run(arguments);
3738
}

lib/src/commands/commands.dart

+4
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,7 @@ class AnalyzeCommand extends PassthroughCommand {
7575
class FormatCommand extends PassthroughCommand {
7676
FormatCommand() : super(const uni.FormatCommand());
7777
}
78+
79+
class TestCommand extends PassthroughCommand {
80+
TestCommand() : super(const uni.TestCommand());
81+
}

lib/src/uni_commands.dart

+17
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,20 @@ class FormatCommand extends UniCommand {
7979
return null;
8080
}
8181
}
82+
83+
class TestCommand extends UniCommand {
84+
const TestCommand()
85+
: super(
86+
name: "test",
87+
description: "Run all the tests.",
88+
);
89+
90+
@override
91+
List<String> getArgsFor(Tool tool) {
92+
if (tool is DartTool || tool is FlutterTool) {
93+
return ["test"];
94+
}
95+
96+
return null;
97+
}
98+
}

0 commit comments

Comments
 (0)