File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ const envToBoolean = (envVar) => {
1010 * @param {boolean } [inScenario=isBrowser] Is this used as `scenarios: { <scenarioName>: defaultOptions(...) }`?
1111 * @param {boolean } [isBrowser=false] Is this a browser test?
1212 * @param {boolean } [isDebug=env.DEBUG_K6] Are we running in debug mode?
13+ * @param {import('k6/options').Options } [otherOptions] Other options to merge in
1314 * @return {import('k6/options').Options }
1415 * */
1516export const defaultOptions = ( {
@@ -18,16 +19,25 @@ export const defaultOptions = ({
1819 // Browser tests options can only be set inside `scenarios`
1920 // https://grafana.com/docs/k6/latest/using-k6-browser/
2021 inScenario = isBrowser ,
22+ ...otherOptions
2123} = { } ) => {
24+ const thresholds = {
25+ checks : [ 'rate>0.90' ] ,
26+ http_req_failed : [ 'rate<0.05' ] ,
27+ } ;
2228 const baseOptions = isDebug
2329 ? {
2430 vus : 1 ,
2531 iterations : 1 ,
2632 httpDebug : inScenario ? undefined : 'full' ,
33+ thresholds,
34+ ...otherOptions ,
2735 }
2836 : {
2937 vus : 10 ,
3038 duration : '30s' ,
39+ thresholds,
40+ ...otherOptions ,
3141 } ;
3242 if ( inScenario ) {
3343 // See https://github.com/grafana/k6-learn/blob/main/Modules/III-k6-Intermediate/08-Setting-load-profiles-with-executors.md
You can’t perform that action at this time.
0 commit comments