All files / src/emulator-state util.js

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

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 181x 1x                 1x 74x       74x    
import * as EnvVariableUtil from 'emulator-state/environment-variables';
import * as PathUtil from 'fs/util/path-util';
 
/**
 * Converts a given path to an absolute path using the
 * current working directory
 * @param  {EmulatorState} state emulator state
 * @param  {string} path         path (relative or absolute)
 * @return {string}              absolute path
 */
export const resolvePath = (state, path) => {
  const cwd = EnvVariableUtil.getEnvironmentVariable(
    state.getEnvVariables(), 'cwd'
  );
 
  return PathUtil.toAbsolutePath(path, cwd);
};