Skip to content

Commit

Permalink
refactor(expect): log msg when unsupported expectation is used (#2667)
Browse files Browse the repository at this point in the history
  • Loading branch information
InesNi committed Apr 29, 2024
1 parent 4b6546e commit e3e1aa5
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions packages/artillery-plugin-expect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,21 @@ function expectationsPluginCheckExpectations(
_.each(expectations, (ex) => {
const checker = Object.keys(ex)[0];
debug(`checker: ${checker}`);
let result = EXPECTATIONS[checker]?.call(
this,
ex,
body,
req,
res,
userContext
);
results.push(result);

let result;
if (EXPECTATIONS[checker]) {
result = EXPECTATIONS[checker].call(
this,
ex,
body,
req,
res,
userContext
);
results.push(result);
} else {
console.log(`Expect Plugin: Expectation '${checker}' is not supported`);
}
});

userContext.expectations = [].concat(userContext.expectations || []);
Expand Down

0 comments on commit e3e1aa5

Please sign in to comment.