question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CI: Can't run because no spec files were found.

See original GitHub issue

I am able to run the tests using the glob pattern on my machine and cypress/included images., but cypress is not able to find the specs using the same glob pattern on gitlab-ci. I have tried single spec files as well but getting the same error every single time

Current behavior:

Gilab-ci Output logs:

Running with gitlab-runner 12.2.0 (a987417a)
  on autoscale-runner 534549a7
Using Docker executor with image cypress/base:14.0.0 ...
Pulling docker image cypress/base:14.0.0 ...
Using docker image sha256:aad0146abdcbc01d662e34c13eb0f29772f7e54d04835b07549d0f8d67af1909 for cypress/base:14.0.0 ...
Running on runner-534549a7-project-133-concurrent-0 via runner-534549a7-gitlab-1598262636-0206bc8b...
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/qa/functional-tests/cypressautomation/.git/
Checking out 52d2fd42 as master...
Removing .npm/
Removing cache/
Removing node_modules/

Skipping Git submodules setup
Checking cache for master...
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
Successfully extracted cache
$ pwd
/builds/qa/functional-tests/cypressautomation
$ ls -ltrh
total 212K
-rw-rw-rw-   1 root root 1.6K Aug 24 09:52 package.json
-rw-rw-rw-   1 root root 171K Aug 24 09:52 package-lock.json
-rw-rw-rw-   1 root root 2.2K Aug 24 09:52 dockerfile
-rw-rw-rw-   1 root root  196 Aug 24 09:52 docker-compose.yaml
-rw-rw-rw-   1 root root  324 Aug 24 09:52 cypress.json
-rw-rw-rw-   1 root root   85 Aug 24 09:52 applitools.config.js
drwxrwxrwx   6 root root 4.0K Aug 24 09:52 Cypress
drwxr-xr-x 406 root root  12K Aug 24 09:52 node_modules
drwxrwxrwx   3 root root 4.0K Aug 24 09:53 cache

$ ls -ltrh ./Cypress/integration/client1/*/*
-rw-rw-rw- 1 root root 1.8K Aug 24 09:52 ./Cypress/integration/client1/programAdmin/userProfileUpdate_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.3K Aug 24 09:52 ./Cypress/integration/client1/programAdmin/loginTest_Lvl1_spec.js
-rw-rw-rw- 1 root root 1005 Aug 24 09:52 ./Cypress/integration/client1/programAdmin/Notifications_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.4K Aug 24 09:52 ./Cypress/integration/client1/programAdmin/MyCard_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.4K Aug 24 09:52 ./Cypress/integration/client1/programAdmin/HomePageValidation_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.3K Aug 24 09:52 ./Cypress/integration/client1/programAdmin/AddUser_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.7K Aug 24 09:52 ./Cypress/integration/client1/manager/userProfileUpdate_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.3K Aug 24 09:52 ./Cypress/integration/client1/manager/loginTest_Lvl1_spec.js
-rw-rw-rw- 1 root root 1016 Aug 24 09:52 ./Cypress/integration/client1/manager/Notifications_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.5K Aug 24 09:52 ./Cypress/integration/client1/manager/HomePageValidations_Lvl1_spec.js
-rw-rw-rw- 1 root root  822 Aug 24 09:52 ./Cypress/integration/client1/cardUser/loginTest_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.1K Aug 24 09:52 ./Cypress/integration/client1/cardUser/Notifications_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.5K Aug 24 09:52 ./Cypress/integration/client1/cardUser/HomePageValidations_Lvl1_spec.js
-rw-rw-rw- 1 root root 2.0K Aug 24 09:52 ./Cypress/integration/client1/bankAdmin/userProfileUpdate_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.3K Aug 24 09:52 ./Cypress/integration/client1/bankAdmin/loginTest_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.5K Aug 24 09:52 ./Cypress/integration/client1/bankAdmin/HomePageValidation_Lvl1_spec.js
-rw-rw-rw- 1 root root 1009 Aug 24 09:52 ./Cypress/integration/client1/ReportingAdmin/Notifications_Lvl1_spec.js
-rw-rw-rw- 1 root root 1.4K Aug 24 09:52 ./Cypress/integration/client1/ReportingAdmin/HomePageValidation_Lvl1_spec.js
$ npx cypress run --spec "./Cypress/integration/client1/*/*" --env testEnv=QA,client=NW
Can't run because no spec files were found.
	
We searched for any files matching this glob pattern:

Cypress/integration/client1/*/*
ERROR: Job failed: exit code 1

Desired behavior:

Test code to reproduce

gitlab-ci yaml file

stages:
    - build
    - test

variables:
    npm_config_cache: "$CI_PROJECT_DIR/.npm"
    CYPRESS_CACHE_FOLDER: "$CI_PROJECT_DIR/cache/Cypress"
    
cache:
    key: ${CI_COMMIT_REF_SLUG}
    paths:
        - .npm
        - cache/Cypress
        - node_modules/

install:
    image: cypress/base:14.0.0
    stage: build
    script: 
        - npm ci
        - npx eyes-setup
        - npx cypress cache path
        - npx cypress cache list
        - $(npm bin)/print-env CI
        - $(npm bin)/cypress verify
        - $(npm bin)/cypress info   

.testExecutionTemplate: &executionTemplate
    stage: test
    image: cypress/base:14.0.0
    artifacts:
        expire_in: 1 day
        when: on_success
        paths:
            - ./cypress/screenshots 
            - ./cypress/videos 
            - ./cypress/mochawesome-report

execute client1 Tests:
    <<: *executionTemplate
    script:
        - pwd
        - ls -ltrh
        - ls -ltrh ./Cypress/integration/client1/*/*
        - npx cypress run --spec "./Cypress/integration/client1/*/*" --env testEnv=QA,client=NW

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bahmutovcommented, Aug 31, 2020

Closing as resolved, since this is OS-specific file system nuance

0reactions
fgiliocommented, Aug 30, 2020

Thanks for sharing the solution. I’ve been bitten sooo many times by Mac’s canse insensitive filesystem 🙃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress and Docker - Can't run because no spec files were ...
The problem: No cypress specs files were found on your automation suite. Solution: Cypress Test files are located in cypress/integration by ...
Read more >
spec won't find a file in the current directory · Issue #2256
OK the test file exists in the current dir. $ $(npm bin)/cypress run --spec 'createOrder.spec.js' Can't run because no spec files were found....
Read more >
Solve The User Problem | Better world by better software
Can't run because no spec files were found. We searched for any files matching this glob pattern: my-spec.js. With respect to the project ......
Read more >
Command Line | Cypress Documentation
No spec files found $ cypress run --spec not-found.js ... Can't run because no spec files were found. We searched for any files...
Read more >
Specify the Cypress spec files to run on BrowserStack
You can use the specs key in run_settings option to specify the spec files that you want to run on BrowserStack. ... For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found