1
votes

I am trying to run the following test on Cypress, but I am getting this error: No tests found in your file: /Users/Name/Desktop/MyFolder/cypress-tutorial-build-todo-starter/cypress/integration/app-init.spec.js We could not detect any tests in the above file. Write some tests and re-run.

I thought I did have a test written as you can see below, especially since I have the it function. Can someone tell me why I may be getting this error? This is the second file I have with a test in my integration folder. Not sure if that makes a difference.

const todos = [
    {
      "id": 1,
      "name": "Buy Milk",
      "isComplete": false
    },
    {
      "id": 2,
      "name": "Buy Eggs",
      "isComplete": false
    },
    {
      "id": 3,
      "name": "Buy Bread",
      "isComplete": false
    },
    {
      "id": 4,
      "name": "Make French Toast",
      "isComplete": false
    }
  ]
  
  describe('App Initialization', () => {
    it.only('Loads todos on page load', () => {
    cy.server()
    cy.route('GET', '/api/todos', todos)
    cy.visit('/')
    })
  
    cy.get('.todo-list li')
      .should('have.length', 4)
  })
1
You should employ proper code indentation - you last cy command is outside the test.Ackroydd

1 Answers

-1
votes

As far as the log concern, it shows that app-init.spec.js file doesn't exist in /Users/Name/Desktop/MyFolder/cypress-tutorial-build-todo-starter/cypress/integration/

Please check the path in the directory and also verify the "integrationFolder" path in cypress.json. If the path doesn't match to the path where your test resides, then Cypress cannot detect test file to run.