CLI Config

These are all the available CLI config options:

{
  // The URL for HyperTest's backend that serves your dashboard
  htBackendBaseUrl: 'http://your-domain-host.com',

  // It's a UUID(generated by HyperTest) of the service you want to test,
  // you can find this on the dashboard (http://[[ADD_HOST_HERE]]/dashboard/#/services)
  // Required Config (Can't be blank)
  serviceIdentifier: '[[SERCVICE_UUID]]',

  // This is authentication token required for running the test
  // you can generate one from the dashboard (http://[[ADD_HOST_HERE]]/dashboard/#/profile)
  // Required Config (Can't be blank)
  htCliRefreshToken: 'your-refresh-token',

  // This tells us what kind of request types you want to test for the current service
  // If you're service exposes both HTTP and GRAPHQL APIs and you want to cover them
  // in the same test them include them like: ['HTTP','GRAPHQL']
  // All the available options: ['HTTP','GRAPHQL','KAFKA','GRPC','AMQP']
  requestTypesToTest: ['HTTP'],

  // The base URL for the HTTP application being tested
  // as the CLI spawns the application process, the host should be localhost
  // or other host that would resolve locally e.g., "127.0.0.1", "0.0.0.0", "::"
  // localhost should be fine for most cases
  // Required Config when requestTypesToTest includes: 'HTTP'
  httpCandidateUrl: 'http://localhost:9999',

  // The base URL for the GRAPHQL application being tested
  // as the CLI spawns the application process, the host should be localhost
  // or other host that would resolve locally e.g., "127.0.0.1", "0.0.0.0", "::"
  // localhost should be fine for most cases
  // Required Config when requestTypesToTest includes: 'GRAPHQL'
  graphqlCandidateUrl: 'http://localhost:9999',

  // `httpReqsToTest` is an optional array of HTTP request IDs to be tested
  // only these IDs will be tested
  httpReqsToTest: [1, 2, 3],

  // `grpcReqsToTest` is an optional array of gRPC request IDs to be tested
  // only these IDs will be tested
  grpcReqsToTest: [101, 102],

  // `appStartCommand` is the command to start the application
  // for example if you want to run your application using npm
  // the whole command would look like this: npm run start-app
  // In this config option you just need to pass the initial command
  // which is just "npm", other bits will be covered in appStartCommandArgs
  // e.g., appStartCommand = 'npm';  appStartCommandArgs = ['run', 'start-app'],
  appStartCommand: 'npm',

  // `appStartCommandArgs` is an array of additional arguments for the start command
  appStartCommandArgs: [],

  // the directory where the app should be started, defaults to the current working directory
  appWorkingDirectory: '/path/to/working/directory',

  // this tells how long we should wait before the app under test becomes responsive
  // defaults to 10sec
  appStartTimeoutSec: 10,

  // `showAppStdErrLogs` indicates whether to show stderr logs of the application
  // defaults to true
  showAppStdErrLogs: true,

  // `showAppStdOutLogs` indicates whether to show stdout logs of the application
  // defaults to false
  showAppStdOutLogs: false,

  // indicates whether to report differences in HTTP headers,
  // defaults to false
  shouldReportHeaderDiffs: false,

  // specifies the batch size for concurrent tests, defaults to 50
  testBatchSize: 50,

  // optional limit for the number of requests to be tested
  testRequestsLimit: 100,

  // Optional config for filtering and testing particular HTTP requests based on method and path
  // the strings could be plain combination of method and path for exact matches or 
  // you could also pass a string containing regex for the path, examples given below:
  // 1. plain exact match: "GET /api/v1/users"
  // 2. path exact match without specific method: "/api/v1/users"
  // 3. regex for path: "ANY REGEX:^/payments"
  httpReqFiltersArr: ['/api/v1/users'],

  // Optional headers for requests to the HyperTest's backend service
  // When you host your own instance of HyperTest you might need to add these headers
  // for the reverse proxy to allow these CLI requests
  // NOTE: In the hosted trial a basic auth header is always required
  htExtraHeaders: {
    'X-Custom-Header': 'custom-value',
  },

  // An optional function to ignore certain mock differences
  // You can check out the documentation for it: Ignoring Differences
  filterFunctionToIgnoreMockDiffs: ({ mockDiff, requestObj, currentMock }) => {
    // Custom logic to ignore certain mock differences
    
    // Return false to discard a difference form the report
    // return false;
    // Return true to keep the difference in report
    return true;
  },
  
  
  // An optional function to ignore certain response differences
  // You can check out the documentation for it: Ignoring Differences
  filterFunctionToIgnoreResponseDiffs: ({ responseDiff, requestObj }) => {
    // Custom logic to ignore certain response differences
    
    // Return false to discard a difference form the report
    // return false;
    // Return true to keep the difference in report
    return true;
  }

  // `exitCodeSetter` is an optional function to set the exit code based on the
  // outcome of the test. This is helpful when you're running test in CI env
  // dont want the job to fail because of failure in HyperTest's test run.
  exitCodeSetter: (result) => {
    return result.success ? 0 : 1;
  },

  // `autoAcceptChangesInCaseOnlyNoiseDetected` specifies whether to auto-accept changes with only noise
  // defaults to true
  autoAcceptChangesInCaseOnlyNoiseDetected: true,

  // requests which contain the mentioned tags will be tested.
  // Refer Tags under "User Guides/Node.js SDK" for more information.
  // Is an optional array of key-value pairs of tags 
  tags: [{ name: 'env', value: 'production' }],

  // Optional list of strings to ingore while comparing string values for
  // reporting differences, these strings are combined to build one regex for comparison
  // you need to escape characters that are used in regex such as: "."
  // e.g., ['01\.02\.03\.04', 'HyPeRtEsT']
  exclusionStringsForDifferences: []
 
  // Optional config to let HyperTest know which ports are being used by the app itself
  // this would avoid port clashes
  reservedAppPorts: [9999],

  // specifies the buffer size of the SDK client which fetches the root mocks
  // You might want to tweak this if you get a maxBuffer exceeded error on SDK side
  // defaults to 200MB
  fetchRootMockBufferSizeInMB: 200,

  // `fastMode` indicates whether to run the tests in fast mode, defaults to false
  // You can read the detailed documentation here: Impact Features/ Fast Mode
  fastMode: false,

  // optional array of statuses to test for, must be 'OKAY' or 'ERROR'
  // This is useful when you want to only test the requests which were successfull
  // the only one that failed. The success and failure of a request is decided
  // on the basis on status codes.
  // OKAY === SUCCESS | ERROR === FAILURE
  outputStatusesToTest: ['OKAY'],
  
  // Indicates whether the SDK should throw and error during REPLAY in a HTTP outbound call
  // deaults to false
  shouldEmitErrorInHttpOutbound: false,

  // `shouldReportRootMockDifferences` indicates whether to report root mock differences
  // defaults to false
  shouldReportRootMockDifferences: false,
}

Last updated