Skip to content

Commit e3e1aa5

Browse files
authored
refactor(expect): log msg when unsupported expectation is used (#2667)
1 parent 4b6546e commit e3e1aa5

File tree

1 file changed

+15
-9
lines changed
  • packages/artillery-plugin-expect

1 file changed

+15
-9
lines changed

packages/artillery-plugin-expect/index.js

+15-9
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,21 @@ function expectationsPluginCheckExpectations(
123123
_.each(expectations, (ex) => {
124124
const checker = Object.keys(ex)[0];
125125
debug(`checker: ${checker}`);
126-
let result = EXPECTATIONS[checker]?.call(
127-
this,
128-
ex,
129-
body,
130-
req,
131-
res,
132-
userContext
133-
);
134-
results.push(result);
126+
127+
let result;
128+
if (EXPECTATIONS[checker]) {
129+
result = EXPECTATIONS[checker].call(
130+
this,
131+
ex,
132+
body,
133+
req,
134+
res,
135+
userContext
136+
);
137+
results.push(result);
138+
} else {
139+
console.log(`Expect Plugin: Expectation '${checker}' is not supported`);
140+
}
135141
});
136142

137143
userContext.expectations = [].concat(userContext.expectations || []);

0 commit comments

Comments
 (0)