What is the working directory for pre-steps?

I’m trying to use the Cypress Orb. The relevant section of my config is

    description: 'Restore code, dependencies, and compiled assets from workspace'
      - attach_workspace:
          at: ~/repo

  cypress: cypress-io/cypress@1.8.0

  version: 2
      - compile
      - cypress/run:
          executor: node_ruby_mysql_redis
            - restore_workspace
            - run: ls -A1
            - run: pwd
            - yarn_install
            - bundle_install
            - ensure_runtime
            - compile
          start: RAILS_ENV=test RACK_ENV=test bundle exec puma -p 3000
          wait-on: 'http://localhost:3000'
          working_directory: ~/repo
          yarn: true

The ls -A1 step emits nothing. The pwd step emits /root/project. I expect that attach_workspace attaches to ~/repo, though it doesn’t emit any debugging information, so I’m not sure. I don’t see /root/project anywhere in the Cypress Orb source, so my hypothesis is that it comes from the CircleCI Orb framework.

Could you try with - run: ls -A1 ~/repo to list the files in the restored workspace?

ls -A1 ~/repo lists the repo files I expect.

Moving the working_directory into the executor actually solves the problem:

    working_directory: ~/repo

Apparently overriding the working_directory at the job-level doesn’t apply to pre-steps. Fortunately, the executor method works for my case.

Pre-steps are run in the same executor as the rest of the steps, so it’s likely your config change fixed an underlying issue of some kind in your config. The steps in that case are all prefixed into the job when the run job in the cypress orb is expanded into verbose config.