@gregoriusrippenstein/erlang-red-unittest 0.12.3 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nodes/ut-assert-debug.js +18 -17
- package/nodes/ut-assert-status.js +17 -16
- package/nodes/ut-assert-success.js +1 -0
- package/nodes/ut-assert-values.js +3 -0
- package/package.json +1 -1
package/nodes/ut-assert-debug.js
CHANGED
|
@@ -11,25 +11,26 @@ module.exports = function(RED) {
|
|
|
11
11
|
|
|
12
12
|
/* msg handler, in this case pass the message on unchanged */
|
|
13
13
|
node.on("input", function(msg, send, done) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
// How to send a status update
|
|
15
|
+
node.status({ fill: "green", shape: "ring", text: RED._("ut-assert-debug.label.statusset") });
|
|
16
|
+
setTimeout(() => { node.status({}); }, 1000)
|
|
17
|
+
|
|
18
|
+
// Send a message and how to handle errors.
|
|
19
|
+
try {
|
|
18
20
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
done();
|
|
26
|
-
}
|
|
27
|
-
} catch (err) {
|
|
28
|
-
// use done if the node won't send anymore messages for the
|
|
29
|
-
// message it received.
|
|
30
|
-
msg.error = err
|
|
31
|
-
done(err.message, msg)
|
|
21
|
+
send(msg);
|
|
22
|
+
done();
|
|
23
|
+
} catch ( err ) {
|
|
24
|
+
// use node.error if the node might send subsequent messages
|
|
25
|
+
node.error("error occurred", { ...msg, error: err })
|
|
26
|
+
done();
|
|
32
27
|
}
|
|
28
|
+
} catch (err) {
|
|
29
|
+
// use done if the node won't send anymore messages for the
|
|
30
|
+
// message it received.
|
|
31
|
+
msg.error = err
|
|
32
|
+
done(err.message, msg)
|
|
33
|
+
}
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -11,25 +11,26 @@ module.exports = function(RED) {
|
|
|
11
11
|
|
|
12
12
|
/* msg handler, in this case pass the message on unchanged */
|
|
13
13
|
node.on("input", function(msg, send, done) {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// How to send a status update
|
|
15
|
+
node.status({ fill: "green", shape: "ring", text: RED._("ut-assert-status.label.statusset") });
|
|
16
|
+
setTimeout(() => { node.status({}); }, 1000)
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
// Send a message and how to handle errors.
|
|
19
|
+
try {
|
|
18
20
|
try {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
done();
|
|
26
|
-
}
|
|
27
|
-
} catch (err) {
|
|
28
|
-
// use done if the node won't send anymore messages for the
|
|
29
|
-
// message it received.
|
|
30
|
-
msg.error = err
|
|
31
|
-
done(err.message, msg)
|
|
21
|
+
send(msg);
|
|
22
|
+
done();
|
|
23
|
+
} catch ( err ) {
|
|
24
|
+
// use node.error if the node might send subsequent messages
|
|
25
|
+
node.error("error occurred", { ...msg, error: err })
|
|
26
|
+
done();
|
|
32
27
|
}
|
|
28
|
+
} catch (err) {
|
|
29
|
+
// use done if the node won't send anymore messages for the
|
|
30
|
+
// message it received.
|
|
31
|
+
msg.error = err
|
|
32
|
+
done(err.message, msg)
|
|
33
|
+
}
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -18,6 +18,7 @@ module.exports = function(RED) {
|
|
|
18
18
|
// How to send a status update
|
|
19
19
|
if ( (cfg.count || 1) == msgcnt) {
|
|
20
20
|
node.status({ fill: "green", shape: "ring", text: RED._("ut-assert-success.label.succeed") });
|
|
21
|
+
setTimeout(() => { node.status({}); }, 1000)
|
|
21
22
|
} else {
|
|
22
23
|
node.status({ fill: "red", shape: "ring", text: RED._("ut-assert-success.label.failed") + `: ${cfg.count} != ${msgcnt}`});
|
|
23
24
|
}
|
|
@@ -156,6 +156,7 @@ module.exports = function(RED) {
|
|
|
156
156
|
|
|
157
157
|
if (node.context().get("succeed") && cfg.ignore_failure_if_succeed) {
|
|
158
158
|
node.status({ fill: "green", shape: "ring", text: "assert succeed" })
|
|
159
|
+
setTimeout(() => { node.status({}); }, 1000)
|
|
159
160
|
} else {
|
|
160
161
|
if (failures.length > 0 ) {
|
|
161
162
|
node.status({fill: "red", shape: "dot", text: "assert failed"})
|
|
@@ -169,6 +170,8 @@ module.exports = function(RED) {
|
|
|
169
170
|
} else {
|
|
170
171
|
node.context().set("succeed",true)
|
|
171
172
|
node.status({ fill: "green", shape: "ring", text: "assert succeed" })
|
|
173
|
+
setTimeout(() => { node.status({}); }, 1000)
|
|
174
|
+
|
|
172
175
|
msg.assert_succeed = true
|
|
173
176
|
delete msg.assert_failures
|
|
174
177
|
}
|