Skip to content

Commit 0c16746

Browse files
Merge pull request #308 from Workiva/add_release_flag_to_test_task
CPLAT-6557: Add release flag and config option to test task
2 parents 0008415 + 338d5c0 commit 0c16746

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

lib/src/tasks/test/cli.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ class TestCli extends TaskCli {
5757
negatable: false)
5858
..addFlag('delete-conflicting-outputs',
5959
help: 'Deletes conflicting outputs during the build', negatable: false)
60+
..addFlag('release',
61+
abbr: 'r',
62+
negatable: true,
63+
help: 'Runs tests in release mode (i.e. compiled via dart2js).')
6064
..addOption('pub-serve-port',
6165
help:
6266
'Port used by the Pub server for browser tests. The default value will randomly select an open port to use.')
@@ -131,6 +135,8 @@ class TestCli extends TaskCli {
131135
parsedArgs,
132136
config.test.deleteConflictingOutputs);
133137

138+
bool release = TaskCli.valueOf('release', parsedArgs, config.test.release);
139+
134140
// CLI user can specify individual test files to run.
135141
bool individualTestsSpecified = parsedArgs.rest.isNotEmpty;
136142

@@ -196,6 +202,10 @@ class TestCli extends TaskCli {
196202
buildArgs.add('--delete-conflicting-outputs');
197203
}
198204

205+
if (release) {
206+
buildArgs.add('--release');
207+
}
208+
199209
PubServeTask pubServeTask;
200210

201211
if (pubServe) {

lib/src/tasks/test/config.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,30 @@ const List defaultAfterFunctional = const [];
2020
const List defaultBeforeFunctional = const [];
2121
const int defaultConcurrency = 4;
2222
const bool defaultDeleteConflictingOutputs = false;
23-
const bool defaultPauseAfterLoad = false;
24-
const bool defaultPubServe = false;
2523
const bool defaultDisableServeStdOut = false;
26-
const int defaultPubServePort = 0;
27-
const bool defaultIntegration = false;
2824
const bool defaultFunctional = false;
25+
const List<String> defaultFunctionalTests = const [];
26+
const bool defaultIntegration = false;
2927
const List<String> defaultIntegrationTests = const [];
28+
const bool defaultPauseAfterLoad = false;
29+
const List<String> defaultPlatforms = const [];
30+
const bool defaultPubServe = false;
31+
const int defaultPubServePort = 0;
32+
const bool defaultRelease = false;
3033
const bool defaultUnit = true;
3134
const List<String> defaultUnitTests = const ['test/'];
32-
const List<String> defaultFunctionalTests = const [];
33-
const List<String> defaultPlatforms = const [];
3435

3536
class TestConfig extends TaskConfig {
3637
List afterFunctionalTests = defaultAfterFunctional;
3738
List beforeFunctionalTests = defaultBeforeFunctional;
3839
int concurrency = defaultConcurrency;
3940
bool deleteConflictingOutputs = defaultDeleteConflictingOutputs;
41+
bool disableServeStdOut = defaultDisableServeStdOut;
4042
List<String> functionalTests = defaultFunctionalTests;
4143
List<String> integrationTests = defaultIntegrationTests;
4244
List<String> platforms = defaultPlatforms;
4345
bool pubServe = defaultPubServe;
4446
int pubServePort = defaultPubServePort;
45-
bool disableServeStdOut = defaultDisableServeStdOut;
47+
bool release = defaultRelease;
4648
List<String> unitTests = defaultUnitTests;
4749
}

0 commit comments

Comments
 (0)