artillery-plugin-expect
Advanced tools
Comparing version 2.3.1-c08c695 to 2.3.1-c6ee732
30
index.js
@@ -69,2 +69,5 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
script.config.plugins.expect.reportFailuresAsErrors; | ||
userContext.expectationsPlugin.useOnlyRequestNames = | ||
script.config.plugins.expect.useOnlyRequestNames === true || | ||
script.config.plugins.expect.useOnlyRequestNames === 'true'; | ||
@@ -170,14 +173,21 @@ return done(); | ||
if (failedExpectations) { | ||
if (global.artillery) { | ||
global.artillery.suggestedExitCode = 1; | ||
} | ||
if (userContext.expectationsPlugin.reportFailuresAsErrors) { | ||
return done(new Error(`Failed expectations for request ${req.url}`)); | ||
} else { | ||
return done(); | ||
} | ||
} else { | ||
if (!failedExpectations) { | ||
return done(); | ||
} | ||
if (global.artillery) { | ||
global.artillery.suggestedExitCode = 1; | ||
} | ||
if (userContext.expectationsPlugin.reportFailuresAsErrors) { | ||
const filteredRequestName = | ||
userContext.expectationsPlugin.useOnlyRequestNames && req.name | ||
? req.name | ||
: req.url; | ||
return done( | ||
new Error(`Failed expectations for request ${filteredRequestName}`) | ||
); | ||
} | ||
return done(); | ||
} | ||
@@ -184,0 +194,0 @@ |
{ | ||
"name": "artillery-plugin-expect", | ||
"version": "2.3.1-c08c695", | ||
"version": "2.3.1-c6ee732", | ||
"description": "Expectations and assertions for HTTP scenarios", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
271879
540