I am doing a unit test. Cypress now gives an errror. it cannot find the test. but in the login.js file I have written code. I don't understand why it can't find the test, it does exist.

the testcode:

describe("login", () => { beforeEach(() => { cy.visit("http://localhost:8080"); }); 

});

The error:

integration\login.js

We could not detect any tests in the above file. Write some tests and re-run.

Path:

server/cypress/integration/pad/login.js

1

2 Answers

If this is all of your test code, it really doesn't have any test. Add any 'it' and cypress will recognize it as a test.

describe("login", () => { beforeEach(() => { cy.visit("http://localhost:8080"); }); it('Example test', () => { expect(add(1, 2)).to.eq(3) }) }); 
0

just edit the file... from your project's root folder to bypass cypress. Try that too to test, here it worked.

{ //... other file settings "exclude": ["src/main/test/cypress"] } 

note: If you are using eslint, you will have to do one more configuration. Since eslint doesn't let us have a TypScrip file inside the project without being treated.

First: Create a file in the project root called tsconfig-eslint.json. It will extend the other tsconfig but ignore the deletion. Put the following content in it:

{ "extends": "./tsconfig.json", "exclude": [] } 

Second: modify the parseOptions of the .eslint.json file to point to the newly created file:

{ //... rest of the settings "parserOptions": { "project": "./tsconfig-eslint.json" }, } 

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobWpxZW6EeIGOnLCpqpWowG6x0aumq2WTpMKtsIynpq1llp67pXnAp7BmrJWowW7AzmaprqY%3D