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(""); }); 

});

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(""); }); 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" }, } 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.