All files / helpers/validators environment.js

87.5% Statements 7/8
80% Branches 8/10
100% Functions 1/1
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  5x       1x         4x   4x 2x        
export default ({ targetEnvironment }) => {
  if (
    targetEnvironment !== 'development' &&
    targetEnvironment !== 'production'
  ) {
    throw new Error(
      'Invalid target environment, valid values are development or production'
    );
  }
 
  const env = process.env.NODE_ENV || 'development';
 
  if (targetEnvironment === 'development') return env === 'development';
  Eif (targetEnvironment === 'production') return env === 'production';
 
  return false;
};