Sometimes, we want to run only one test with Cypress and JavaScript.
In this article, we’ll look at how to run only one test with Cypress and JavaScript.
How to run only one test with Cypress and JavaScript?
To run only one test with Cypress and JavaScript, we can set the --space
option or use the it.only
method.
For instance, we run
cypress run --spec path/to/file.spec.js
to run the tests in path/to/file.spec.js.
In our test, we write
it.only("only run this one", () => {
// ...
});
it("not this one", () => {});
to run only the first test by calling creating the test with it.only
.
Conclusion
To run only one test with Cypress and JavaScript, we can set the --space
option or use the it.only
method.