Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find config-file #1046

Closed
Christian-Oleson opened this issue Oct 2, 2023 · 8 comments
Closed

Cannot find config-file #1046

Christian-Oleson opened this issue Oct 2, 2023 · 8 comments

Comments

@Christian-Oleson
Copy link

Christian-Oleson commented Oct 2, 2023

In my local setup, I have cypress setup:
reponame/cypress/config/myConfig.json

I've tried the config-file option, including specifying the directories, subdirectories, etc.
e.g.,

config-file: myConfig.json

and nothing seems to resolve the file. I keep getting this error:

DevTools listening on ws://127.0.0.1:42869/devtools/browser/765dff37-7f7b-490f-9a4e-b18bdb5c1079
Could not find a Cypress configuration file.

We looked but did not find a myConfig.json file in this folder: /home/runner/work/reponame/reponame

What is the recommended setup for config files in this runner? Where is the runner starting from in terms of its local directory? e.g. repo root?

@MikeMcC399
Copy link
Collaborator

@Christian-Oleson

The most likely reason for your problem would be if you are using the command parameter. See the README > Custom install command where it says:

"Caution: using the action parameter command causes multiple other parameters to be ignored including: auto-cancel-after-failures, browser, ci-build-id, command-prefix, component, config, config-file, env, group, headed, parallel, project, publish-summary, quiet, record, spec and tag."

If that is not the case, then please post your workflow.

Note that

DevTools listening on ws://127.0.0.1:42869/devtools/browser/765dff37-7f7b-490f-9a4e-b18bdb5c1079

is not an error. It is an informational message which is unrelated to your problem.

@Christian-Oleson
Copy link
Author

Christian-Oleson commented Oct 3, 2023

Thanks for the comment @MikeMcC399 . I am not using the command parameter. Here is my workflow:

name: Cypress Tests
on:
  push:
    branches:
      - 'main'
      - 'feature**'
  workflow_dispatch:
    inputs:
      branch:
        config: 'The config to use'
        required: true
        default: "staging"

jobs:
  test:
    name: Cypress run
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Cypress run
        uses: cypress-io/github-action@v6
        with:
          config-file: myConfig.json
          spec: |
            **/*Catalog.cy.js
            **/*Catalog.cy.ts
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I had the config-file replaced with the config parameter locally to try and bypass this problem

@MikeMcC399
Copy link
Collaborator

@Christian-Oleson

Which version of Cypress are you using?

@Christian-Oleson
Copy link
Author

@Christian-Oleson

Which version of Cypress are you using?

@MikeMcC399

"cypress": "^13.3.0",

@MikeMcC399
Copy link
Collaborator

@Christian-Oleson

Thanks for confirming your Cypress version!

There is an error in the README > Config file documentation as far as using the parameter config-file with current configurations (Cypress 10.x and later) is concerned.

According to the Cypress documentation References > Configuration > Configuration File:

This file will be cypress.config.js for JavaScript apps or cypress.config.ts for TypeScript apps.

In Cypress legacy configurations it used to be cypress.json.

You should make sure that you are passing a *.js file to the parameter config-file, not a *.json file since you are using Cypress 13.x.

@MikeMcC399
Copy link
Collaborator

@Christian-Oleson

  • I've submitted a PR Cannot find config-file #1046 to correct the documentation and to provide a working example of using the config-file parameter.

Let us know if you are still having difficulties after checking out my previous post #1046 (comment) ^^

@Christian-Oleson
Copy link
Author

@Christian-Oleson

  • I've submitted a PR Cannot find config-file #1046 to correct the documentation and to provide a working example of using the config-file parameter.

Let us know if you are still having difficulties after checking out my previous post #1046 (comment) ^^

Totally, I'm still trying to get this to work, so I'll be working through the issue on my end now. Per your above explanation, it sounds like that is the issue I am hitting.

@Christian-Oleson
Copy link
Author

The above documentation fix resolved this for me. Thank you @MikeMcC399 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants