packages/ant-cli/spec/bin/ant.spec.js
async function _expectErrorMessage(args, ...errorMessages) {
  expect.hasAssertions();
  try {
    await exec(getAntCommand(args));
    throw new Error('It is expected to throw some error');
  } catch (e) {
    const { code, stdout, stderr } = e;
    expect(code).toEqual(1);
    expect(stdout).toEqual('');
    for(const errorMessage of errorMessages) {
      expect(stderr).toContain(errorMessage);
    }
  }
}
async function _expectErrorMessage(args, ...errorMessages) {
  expect.hasAssertions();
  try {
    await exec(getAntCommand(args));
    throw new Error('It is expected to throw some error');
  } catch (e) {
    const { code, stdout, stderr } = e;
    expect(code).toEqual(1);
    expect(stdout).toEqual('');
    for(const errorMessage of errorMessages) {
      expect(stderr).toContain(errorMessage);
    }
  }
}
async function _expectErrorMessage ( args , ... errorMessages ) { expect . hasAssertions ( ) ; try { await exec ( getAntCommand ( args ) ) ; throw new Error ( 'It is expected to throw some error' ) ; } catch ( e ) { const { code , stdout , stderr } = e ; expect ( code ) . toEqual ( 1 ) ; expect ( stdout ) . toEqual ( '' ) ; for ( const errorMessage of errorMessages ) { expect ( stderr ) . toContain ( errorMessage ) ; } } }
Helper function to run the CLI command with args and check the expected error
messages as an output.
@param {string} args The args to be sent to the CLI command.
@param {string} errorMessages The expected error messages.
@async
@private
Helper function to run the CLI command with args and check the expected error messages as an output .