You should put the path in quotation marks as a string:
my_job: stage: test script: - cd "$CI_PROJECT_DIR/sub_folder"