How to use thresholds in a custom scenario?

I am attempting to make a scenario for a specific test based on the K6_ENV env variable. However, I am having issues with the thresholds. Any ideas, please, on how to use the thresholds in this manner?

  const options = {
    scenarios: {
  
      dev_scenario: {           
          executor: 'ramping-vus',
          startVUs: 0,         
          stages: [             
            { duration: '10s', target: 10 },
            { duration: '5s', target: 0 },
          ],        
          gracefulRampDown: '0s',        
          env: { K6_ENV: 'dev' },               
          tags: { runTag: 'createNewPatient' },
          thresholds: {
            // http_req_failed: ['rate<0.01'],          
            http_req_duration: [{
              threshold: 'p(99.5)<100',       
              //abortOnFail: true,       
              delayAbortEval: "5s",                 
            }],                              
        },
      },
                          
    },                                    
  }; 

Hi @k6_tesing_is_fun,

the thresholds options are not part of a scenario definition. They need to be under the options along the scenarios keys.

Hope this helps you!