mocha Done() not find when using Typescript
See original GitHub issuehttps://docs.cypress.io/api/events/catalog-of-events.html#App-Events has multiple examples using done()
I’m using typescript and in the following piece of code:
cy.on('window:load', (win) => {
....
done();
});
i get the following error: [ts] cannot find name ‘done’
my tsconfig.json has the following includes:
"include": [
"node_modules/cypress",
"cypress/**/*.ts"
],
Desired behavior:
I expected the done to be recognised as valid.
Versions
Cypress: 3.0.1. Beta OS: Win 7 Browser: Chrome 64
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
WebStorm can not find ts-node/module and describe definition ...
I am having problems setting up WebStorm with Mocha ...
Read more >How to Fix the “Cannot Find name 'describe'” Error in TypeScript
To fix the “cannot find name 'describe'” error, install the type definitions for your testing framework, and then add the definitions to the ......
Read more >Cannot find name 'describe' Error in TypeScript | bobbyhadz
To solve the "Cannot find name 'describe'" error, install the type definitions for your test runner, e.g. npm i -D @types/jest or npm...
Read more >Mocha for TypeScript Testing: How to Get Started - Testim Blog
Mocha is a popular JavaScript test framework that's often used for testing Node.js applications. It's a widely used testing tool for both ...
Read more >Unit testing JavaScript and TypeScript - Visual Studio (Windows)
NET Core and JavaScript or TypeScript, see Write unit tests for ASP.NET Core . ... For a Mocha unit test, use the following...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
done
is not a global and has to be used in the scope of anit
,before
, orbeforeEach
block, like so:I’d need to know more about what you’re doing to be sure, but it looks like what you’re trying to do is unnecessary. If you use
cy.visit()
, Cypress already waits until theload
event fires on the page to run subsequent commands, so there’s no need to manually wait forwindow:load
.cy.on(‘window:load’) is fired when the main paged is loaded. But the main page contains an iframe which also loads content.
The waitForIFRameReady() waits for the iframe to be ready and after that the waitForIFrameBody() checks for the content of the iframe to be present. If that’s the case then I do the it.
I will try your suggestion.
thx