hunk.code_window: import PATH from 'path-name'
   import semver from 'semver'
   afterEach(async () => {
     // @ts-expect-error
     await global.finishWorkers?.()
   })
   test('install Node (and npm, npx) by exact version of Node.js', async () => {
     tempDir()
     const configDir = path.resolve('config')
     await env.handler({
  
hunk.labels: keep keep keep replace replace replace replace replace keep keep keep keep keep
hunk.file_path: env/plugin-commands-env/test/env.test.ts
hunk.type: replace
file: import { PnpmError } from '@pnpm/error'
  import { parseWantedDependency } from '@pnpm/parse-wanted-dependency'
  
  const DELIMITER_REGEX = /[^ |@]>/
  
  export interface VersionOverride {
    parentPkg?: {
      name: string
      pref?: string
    }
    targetPkg: {
      name: string
      pref?: string
    }
    newPref: string
  }
  
  export function parseOverrides (
    overrides: Record<string, string>
  ): VersionOverride[] {
    return Object.entries(overrides)
      .map(([selector, newPref]) => {
        let delimiterIndex = selector.search(DELIMITER_REGEX)
        if (delimiterIndex !== -1) {
          delimiterIndex++
          const parentSelector = selector.substring(0, delimiterIndex)
          const childSelector = selector.substring(delimiterIndex + 1)
          return {
            newPref,
            parentPkg: parsePkgSelector(parentSelector),
            targetPkg: parsePkgSelector(childSelector),
          }
        }
        return {
          newPref,
          targetPkg: parsePkgSelector(selector),
        }
      })
  }
  
  function parsePkgSelector (selector: string) {
    const wantedDep = parseWantedDependency(selector)
    if (!wantedDep.alias) {
      throw new PnpmError('INVALID_SELECTOR', `Cannot parse the "${selector}" selector`)
    }
    return {
      name: wantedDep.alias,
      pref: wantedDep.pref,
    }
  }
  