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

Using --spec option results in "no specs found" when project is located at Docker root directory #23380

Closed
BenDaSpur opened this issue Aug 16, 2022 · 9 comments · Fixed by #23535
Assignees

Comments

@BenDaSpur
Copy link

Current behavior

image

All that changed is the version number in my dockerfile

If I downgrade from there to 10.4.0 I have no issues.

Desired behavior

Tests should run with no errors

Test code to reproduce

Build cypress/included:10.5.0

Try doing a cypress run

Cypress Version

10.5.0

Node version

16.16.0

Operating System

Linux

Debug Logs

Your supportFile is missing or invalid: support/e2e.ts

The supportFile must be a .js, .ts, .coffee file or be supported by your preprocessor plugin (if configured).

Fix your support file, or set supportFile to false if a support file is not necessary for your project.

If you have just renamed the extension of your supportFile, restart Cypress.

https://on.cypress.io/support-file-missing-or-invalid

Other

No response

@tbiethman
Copy link
Contributor

@BenDaSpur this issue was previously reported and fixed in 10.6.0, which was just released. Can you try 10.6.0 and report back?

@BenDaSpur
Copy link
Author

@tbiethman I am not having that issue anymore but on 10.6 I am getting this issue saying no spec files were found
image

and in my config I have:
specPattern: 'cypress/e2e/tests/**/*.cy.ts',

@tbiethman
Copy link
Contributor

@BenDaSpur hmm, are you running your command with a particular --spec filter?

@BenDaSpur
Copy link
Author

BenDaSpur commented Aug 16, 2022

@tbiethman yes, this is what it looks like
cypress run --spec ./cypress/e2e/tests/api/REST.cy.ts --headless --browser chrome --config chromeWebSecurity=false,trashAssetsBeforeRuns=false,baseUrl=https://demo.*****.com --reporter mochawesome --reporter-options reportFilename=REST,html=false,overwrite=false,reportDir=/cypress/results/tests --env SERVER=***,SERVER_URL=https://*********.com,VENDOR_ID=********,API_KEY=******

@tbiethman
Copy link
Contributor

tbiethman commented Aug 16, 2022

@BenDaSpur gotcha, that looks right. Can you share how you're using the container in a little more depth? It looks like you have your project files in the root directory, and are running cypress from the root directory?

@BenDaSpur
Copy link
Author

FROM cypress/included:10.6.0 as base
ENV NODE_ENV=production
# RUN apt-get update
WORKDIR /
COPY ./package.json ./package-lock.json ./

ENV CI=1
RUN npm ci --only=production
RUN cypress verify

FROM base as target
COPY ./cypress.config.ts ./
COPY ./cypress ./cypress
COPY ./entrypoint.sh ./
COPY ./tsconfig.json ./

ENTRYPOINT [ "/entrypoint.sh" ]

My entrypoint script is where that cypress run is happening.

@tbiethman Let me know if you need more info

@tbiethman
Copy link
Contributor

tbiethman commented Aug 16, 2022

@BenDaSpur thank you very much. I can reproduce this with a similar Dockerfile within our reproduction template repo:

FROM cypress/included:10.6.0 as base
# RUN apt-get update
WORKDIR /
COPY ./package.json ./package-lock.json ./

RUN npm i
RUN cypress verify

FROM base as target
COPY ./cypress.config.js ./
COPY ./cypress ./cypress

ENV DEBUG=cypress:data-context:sources:FileDataSource

ENTRYPOINT [ "cypress", "run", "--spec", "**/*.js" ]

The issue is that we're not properly handing projects at root with 10.5.0/10.6.0, specifically when the --spec option is used. You could work around this in the meantime by updating your dockerfile to copy your project into a nested directory. But this is a bug and it will get fixed.

@tbiethman tbiethman self-assigned this Aug 16, 2022
@tbiethman tbiethman changed the title Support file not found with Cypress 10.5 in docker Using --spec option results in "no specs found" when project is located at Docker root directory Aug 17, 2022
@mschile mschile added triage and removed triage labels Aug 18, 2022
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review and removed stage: work in progress labels Aug 24, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 29, 2022

The code for this is done in cypress-io/cypress#23535, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Aug 29, 2022
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 30, 2022

Released in 10.7.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.7.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants