-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCucumberJSDiff
33 lines (24 loc) · 968 Bytes
/
CucumberJSDiff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Diff with Cucumber js lib:
# Added timeout for step https://github.com/cucumber/cucumber-js/pull/192
# Call callback only once https://github.com/cucumber/cucumber-js/pull/199
-----
invoke: function invoke(step, world, scenario, callback) {
+var timeoutValue = Cucumber.Runtime.stepTimeoutValue,
+timeoutRef;
...var cleanUp = function cleanUp() {...
+timeoutRef = setTimeout(function () {
+codeCallback.fail('Timeout');
+}, timeoutValue);
...
...var codeCallback = function (error) {
+if (codeCallback.wasCalled) {
+console.error('Callback was already called for this step : ', step.getName());
+return;
+}
+codeCallback.wasCalled = true;
+clearTimeout(timeoutRef);
...
...codeCallback.pending = function pending(reason) {
+clearTimeout(timeoutRef);
...codeCallback.fail = function fail(failureReason) {
+clearTimeout(timeoutRef);