Skip to content

Commit 3b0825b

Browse files
committed
Merge pull request #131 from Workiva/no_unit_fix
CP-1393 Update test task to observe `--no-unit` flag
2 parents dff3308 + b2478e7 commit 3b0825b

File tree

6 files changed

+39
-4
lines changed

6 files changed

+39
-4
lines changed

lib/src/tasks/test/cli.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ class TestCli extends TaskCli {
111111
if (isExplicitlyFalse(unit) && !integration && individualTests == 0) {
112112
return new CliResult.fail(
113113
'No tests were selected. Include at least one of --unit or --integration.');
114-
} else {
115-
if (individualTests == 0) unit = true;
116114
}
117115

118116
if (unit) {
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: integration_test_passing
2+
version: 0.0.0
3+
dev_dependencies:
4+
dart_dev:
5+
path: ../../../..
6+
test: "^0.12.0"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
library integration_test_passing.test.failing_unit_test;
2+
3+
import 'package:test/test.dart';
4+
5+
void main() {
6+
test('passes', () {
7+
expect(false, isTrue);
8+
});
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
library integration_test_passing.test.passing_integration_test;
2+
3+
import 'package:test/test.dart';
4+
5+
void main() {
6+
test('passes', () {
7+
expect(true, isTrue);
8+
});
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
library integration_test_passing.tool.dev;
2+
3+
import 'package:dart_dev/dart_dev.dart' show dev, config;
4+
5+
main(List<String> args) async {
6+
config.test
7+
..unitTests = ['test/failing_unit_test.dart']
8+
..integrationTests = ['test/passing_integration_test.dart'];
9+
10+
await dev(args);
11+
}

test/integration/test_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import 'package:test/test.dart';
2424
const String projectWithoutTestPackage = 'test/fixtures/test/no_test_package';
2525
const String projectWithFailingTests = 'test/fixtures/test/failing';
2626
const String projectWithPassingTests = 'test/fixtures/test/passing';
27+
const String projectWithPassingIntegrationTests =
28+
'test/fixtures/test/passingIntegration';
2729
const String projectThatNeedsPubServe = 'test/fixtures/test/needs_pub_serve';
2830

2931
Future<bool> runTests(String projectPath,
@@ -106,9 +108,9 @@ void main() {
106108
isTrue);
107109
});
108110

109-
test('should run integration tests', () async {
111+
test('should run integration tests and not unit tests', () async {
110112
expect(
111-
await runTests(projectWithPassingTests,
113+
await runTests(projectWithPassingIntegrationTests,
112114
unit: false, integration: true),
113115
isTrue);
114116
});

0 commit comments

Comments
 (0)