Skip to content

Commit 1016329

Browse files
committed
build: 2.0.1
1 parent ad2e267 commit 1016329

File tree

5 files changed

+1395
-74
lines changed

5 files changed

+1395
-74
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ Add in [plan.json]:
3333
"time": "30s"
3434
}
3535
```
36+
#### We can make it end up failing by indicating the error message:
37+
```json
38+
{
39+
"id": "wait_default",
40+
"time": "0s",
41+
"error": "Caused error for testing"
42+
}
43+
```
3644

3745
[Runnerty]: http://www.runnerty.io
3846
[downloads-image]: https://img.shields.io/npm/dm/@runnerty/executor-wait.svg

index.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,33 @@
22

33
const ms = require('ms');
44

5-
const Execution = global.ExecutionClass;
5+
const Executor = global.ExecutionClass;
66

7-
class waitExecutor extends Execution {
7+
class waitExecutor extends Executor {
88
constructor(process) {
99
super(process);
1010
}
1111

1212
exec(params) {
13+
let endOptions = { end: 'end' };
1314
// Backward compatibility with version 1:
1415
if (params.seconds && !params.time) {
15-
params.time = `${params.seconds}`;
16+
params.time = params.seconds + 's';
1617
}
1718
// 60s default value:
1819
if (!params.seconds && !params.time) {
19-
params.time = `60s`;
20+
params.time = '60 s';
21+
}
22+
23+
if (params.error && params.error != '') {
24+
endOptions.end = 'error';
25+
endOptions.messageLog = params.error;
26+
endOptions.err_output = params.error;
2027
}
2128

2229
setTimeout(() => {
23-
this.end();
24-
}, ms(params.time) || 0);
30+
this.end(endOptions);
31+
}, ms('' + params.time) || 0);
2532
}
2633
}
2734

0 commit comments

Comments
 (0)