@gregoriusrippenstein/erlang-red-unittest 0.10.4 → 0.10.5

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.
@@ -12,4 +12,16 @@ all tests succeed or some failed. This is an all or one flag.
12
12
  <p>
13
13
  The "assert_failures" array value is set on the message to contain all failures and unsupported features.
14
14
 
15
+ <p>
16
+ <b>Ignore if Succeed</b>
17
+
18
+ <p>
19
+ The <i>ignore failure if succeed</i> flag can be used if the assert value node receives multiple messages however as long as one message succeeded, then the assert values node will succeed and messages that failure will be ignored.
20
+
21
+ <p>
22
+ Normally each message is independent of one another but in the case of an assert values node with the flag "ignore failure" set, the node will remain in success mode until Node-RED, the flow or the node is reset/restarted.
23
+
24
+ <p>
25
+ Failures will still be sent to the debug panel however the node status will remain succeeded.
26
+
15
27
  </script>
@@ -20,7 +20,9 @@
20
20
  "noteql": "not equal __property__",
21
21
  "notset": "not set __property__",
22
22
  "debug": "debug __property__",
23
- "unsupported": "supported rule __property__"
23
+ "unsupported": "supported rule __property__",
24
+
25
+ "ignore_failure_if_succeed": "Ignore failure if matched once"
24
26
  },
25
27
 
26
28
  "action": {
@@ -9,6 +9,9 @@
9
9
  name: {
10
10
  value:"",
11
11
  },
12
+ ignore_failure_if_succeed: {
13
+ value: false
14
+ },
12
15
  rules: {
13
16
  value: [{ t: "eql", p: "payload", pt: "msg", to: "", tot: "str" }],
14
17
  validate: function (rules, opt) {
@@ -276,10 +279,18 @@
276
279
  flex: 1;
277
280
  }
278
281
  </style>
282
+
279
283
  <div class="form-row">
280
284
  <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
281
285
  <input type="text" id="node-input-name" style="width: calc(100% - 105px)" data-i18n="[placeholder]node-red:common.label.name">
282
286
  </div>
287
+
288
+ <div class="form-row">
289
+ <input type="checkbox" id="node-input-ignore_failure_if_succeed"
290
+ style="display:inline-block; width:15px; vertical-align:baseline;">
291
+ <label for="node-input-ignore_failure_if_succeed"><span data-i18n="ut-assert-values.label.ignore_failure_if_succeed"></span></label>
292
+ </div>
293
+
283
294
  <div class="form-row" style="margin-bottom:0;">
284
295
  <label><i class="fa fa-list"></i> <span data-i18n="ut-assert-values.label.rules"></span></label>
285
296
  </div>
@@ -127,22 +127,26 @@ module.exports = function(RED) {
127
127
  }
128
128
  })
129
129
 
130
- if (failures.length > 0 ) {
131
- node.status({fill: "red", shape: "dot", text: "assert failed"})
132
- msg.assert_succeed = false
133
- msg.assert_failures = failures.concat(unsupported)
130
+ if (node.context().get("succeed") && cfg.ignore_failure_if_succeed) {
131
+ node.status({ fill: "green", shape: "ring", text: "assert succeed" })
134
132
  } else {
135
- if ( unsupported.length > 0) {
136
- node.status({ fill: "yellow", shape: "ring", text: "unsupported errors - check debug" })
133
+ if (failures.length > 0 ) {
134
+ node.status({fill: "red", shape: "dot", text: "assert failed"})
137
135
  msg.assert_succeed = false
138
- msg.assert_failures = failures.concat( unsupported )
136
+ msg.assert_failures = failures.concat(unsupported)
139
137
  } else {
140
- node.status({ fill: "green", shape: "ring", text: "assert succeed" })
141
- msg.assert_succeed = true
142
- delete msg.assert_failures
138
+ if ( unsupported.length > 0) {
139
+ node.status({ fill: "yellow", shape: "ring", text: "unsupported errors - check debug" })
140
+ msg.assert_succeed = false
141
+ msg.assert_failures = failures.concat( unsupported )
142
+ } else {
143
+ node.context().set("succeed",true)
144
+ node.status({ fill: "green", shape: "ring", text: "assert succeed" })
145
+ msg.assert_succeed = true
146
+ delete msg.assert_failures
147
+ }
143
148
  }
144
149
  }
145
-
146
150
  send(msg);
147
151
  done();
148
152
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/erlang-red-unittest",
3
- "version": "0.10.4",
3
+ "version": "0.10.5",
4
4
  "dependencies": {
5
5
  },
6
6