Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions lib/src/scenario_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ void parseScenario(
List<String> tags,
String scenarioParams,
) {
sb.writeln(
" $testMethodName('''$scenarioTitle''', ($testerName) async {",
);
sb.writeln(" $testMethodName('''$scenarioTitle''', ($testerName) async {");
if (hasHooks) {
sb.writeln(' var $testSuccessVariableName = true;');
}
Expand All @@ -38,7 +36,7 @@ void parseScenario(
}

if (hasHooks) {
sb.writeln(' } on TestFailure {');
sb.writeln(' } catch (_) {');
sb.writeln(' $testSuccessVariableName = false;');
sb.writeln(' rethrow;');
}
Expand Down Expand Up @@ -67,9 +65,7 @@ void parseScenario(
for (final param in scenarioParams.split(', ')) {
sb.writeln(' $param,');
}
sb.writeln(
' );',
);
sb.writeln(' );');
}
}

Expand All @@ -86,9 +82,7 @@ List<List<BddLine>> generateScenariosFromScenarioOutline(
.toList();
}

List<Map<String, String>> _getExamples(
List<BddLine> scenario,
) {
List<Map<String, String>> _getExamples(List<BddLine> scenario) {
final exampleLines = scenario
.skipWhile((l) => l.type != LineType.exampleTitle)
.where((l) => l.type == LineType.examples)
Expand Down
24 changes: 12 additions & 12 deletions test/feature_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ void main() {

test('existing step should not regenerate', () async {
const scenario = 'existing_step';
final dummyStepPath =
p.join(getStepFolderName(scenario), 'the_app_is_running.dart');
final dummyStepPath = p.join(
getStepFolderName(scenario),
'the_app_is_running.dart',
);
const expectedFileContent = '// existing step';
fs.file(dummyStepPath)
..createSync(recursive: true)
Expand All @@ -66,8 +68,11 @@ relativeToTestFolder: false
..writeAsStringSync(bddOptions);

const scenario = 'existing_step_outside_test_folder';
final dummyStepPath =
p.join(fs.currentDirectory.path, 'my_steps', 'the_app_is_running.dart');
final dummyStepPath = p.join(
fs.currentDirectory.path,
'my_steps',
'the_app_is_running.dart',
);
fs.file(dummyStepPath)
..createSync(recursive: true)
..writeAsStringSync('dummy');
Expand Down Expand Up @@ -139,7 +144,7 @@ hookFolderName: hooksFolder
' try {\n'
" await beforeEach('''Testing scenario''');\n"
' await theAppIsRunning(tester);\n'
' } on TestFailure {\n'
' } catch (_) {\n'
' success = false;\n'
' rethrow;\n'
' } finally {\n'
Expand All @@ -164,10 +169,7 @@ hookFolderName: hooksFolder
..writeAsStringSync(bddOptions);

const scenario = 'options';
expect(
() => generate(scenario),
throwsException,
);
expect(() => generate(scenario), throwsException);
});

test('merge options', () async {
Expand Down Expand Up @@ -260,9 +262,7 @@ stepFolderName: ./scenarios
const scenario = 'options';
final content = await generate(
scenario,
const BuilderOptions(<String, dynamic>{
'include': externalYaml3,
}),
const BuilderOptions(<String, dynamic>{'include': externalYaml3}),
);
expect(content, expected);
});
Expand Down
2 changes: 1 addition & 1 deletion test/feature_with_hooks_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void main() {
try {
await beforeEach(\'\'\'Testing scenario\'\'\' );
await theAppIsRunning(tester);
} on TestFailure {
} catch (_) {
success = false;
rethrow;
} finally {
Expand Down
4 changes: 2 additions & 2 deletions test/full_set_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void main() {
await theAppIsRunning(tester);
await iRunCode(tester, 'func foo() {}; func bar() { print("hey!"); };');
await iSeeText(tester, '0');
} on TestFailure {
} catch (_) {
success = false;
rethrow;
} finally {
Expand Down Expand Up @@ -96,7 +96,7 @@ void main() {
await beforeEach(\'\'\'Initial counter value is 0\'\'\' );
await bddSetUp(tester);
await theAppIsRunning(tester);
} on TestFailure {
} catch (_) {
success = false;
rethrow;
} finally {
Expand Down
Loading