Unmocking/Passing Through

This page documents how to tell the hypertest sdk to not mock certain parts of your code.

UnMocked Calls will be called as-is in both RECORD and REPLAY modes. Any network calls make inside the callback of executeUnmocked() would be actually made


import * as htSdk from '@hypertestco/node-sdk';
/**
   .. code normally instrumented by hypertest
**/

// old code
// const axiosResponse = await axios.post('https://myexampleurl.com/api/v1/sample', {"key":"value"});


// new code
const axiosResponse = await htSdk.executeUnmocked(async () => {
  // Anything called here is not captured/mocked by hypertest in any mode
  
  await axios.post('https://myexampleurl.com/api/v1/sample', {"key":"value"});
  // the above http call would not be captured by hypertest during record mode.
  // it would actually hit myexampleurl.com in replay mode.
  
})

Last updated