Skip to content

Commit ea386c5

Browse files
default to synchronous snippets (#1051)
1 parent e3715f6 commit ea386c5

5 files changed

+23
-23
lines changed

features/custom_formatter.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ Feature: custom formatter
112112
? Given an undefined step
113113
Undefined. Implement with the following snippet:
114114
115-
Given('an undefined step', function (callback) {
115+
Given('an undefined step', function () {
116116
// Write code here that turns the phrase above into concrete actions
117-
callback(null, 'pending');
117+
return 'pending';
118118
});
119119
120120

features/snippets_formatter.feature

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@ Feature: snippets formatter
1818
Then it fails
1919
And it outputs the text:
2020
"""
21-
Given('undefined step A', function (callback) {
21+
Given('undefined step A', function () {
2222
// Write code here that turns the phrase above into concrete actions
23-
callback(null, 'pending');
23+
return 'pending';
2424
});
2525
26-
When('undefined step B', function (callback) {
26+
When('undefined step B', function () {
2727
// Write code here that turns the phrase above into concrete actions
28-
callback(null, 'pending');
28+
return 'pending';
2929
});
3030
31-
Then('undefined step C', function (callback) {
31+
Then('undefined step C', function () {
3232
// Write code here that turns the phrase above into concrete actions
33-
callback(null, 'pending');
33+
return 'pending';
3434
});
3535
"""

features/step_definition_snippets.feature

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Feature: step definition snippets
1111
Then it fails
1212
And the output contains the text:
1313
"""
14-
Given('a step numbered {int}', function (int, callback) {
14+
Given('a step numbered {int}', function (int) {
1515
// Write code here that turns the phrase above into concrete actions
16-
callback(null, 'pending');
16+
return 'pending';
1717
});
1818
"""
1919

@@ -28,9 +28,9 @@ Feature: step definition snippets
2828
Then it fails
2929
And the output contains the text:
3030
"""
31-
Given('a step with {string}', function (string, callback) {
31+
Given('a step with {string}', function (string) {
3232
// Write code here that turns the phrase above into concrete actions
33-
callback(null, 'pending');
33+
return 'pending';
3434
});
3535
"""
3636

@@ -45,9 +45,9 @@ Feature: step definition snippets
4545
Then it fails
4646
And the output contains the text:
4747
"""
48-
Given('a step with {string} and {string}', function (string, string2, callback) {
48+
Given('a step with {string} and {string}', function (string, string2) {
4949
// Write code here that turns the phrase above into concrete actions
50-
callback(null, 'pending');
50+
return 'pending';
5151
});
5252
"""
5353

@@ -64,8 +64,8 @@ Feature: step definition snippets
6464
Then it fails
6565
And the output contains the text:
6666
"""
67-
Given('a step with {string}', function (string, callback) {
67+
Given('a step with {string}', function (string) {
6868
// Write code here that turns the phrase above into concrete actions
69-
callback(null, 'pending');
69+
return 'pending';
7070
});
7171
"""

features/step_definition_snippets_i18n.feature

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ Feature: step definition snippets i18n
1919
Then it fails
2020
And the output contains the text:
2121
"""
22-
Given('undefined step A', function (callback) {
22+
Given('undefined step A', function () {
2323
// Write code here that turns the phrase above into concrete actions
24-
callback(null, 'pending');
24+
return 'pending';
2525
});
2626
"""
2727
And the output contains the text:
2828
"""
29-
When('undefined step B', function (callback) {
29+
When('undefined step B', function () {
3030
// Write code here that turns the phrase above into concrete actions
31-
callback(null, 'pending');
31+
return 'pending';
3232
});
3333
"""
3434
And the output contains the text:
3535
"""
36-
Then('undefined step C', function (callback) {
36+
Then('undefined step C', function () {
3737
// Write code here that turns the phrase above into concrete actions
38-
callback(null, 'pending');
38+
return 'pending';
3939
});
4040
"""

src/formatter/builder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default class FormatterBuilder {
5555
supportCodeLibrary,
5656
}) {
5757
if (!snippetInterface) {
58-
snippetInterface = 'callback'
58+
snippetInterface = 'synchronous'
5959
}
6060
let Syntax = JavascriptSnippetSyntax
6161
if (snippetSyntax) {

0 commit comments

Comments
 (0)