types / mocha Goto Github PK
View Code? Open in Web Editor NEWThe type definition for https://github.com/mochajs/mocha
License: MIT License
The type definition for https://github.com/mochajs/mocha
License: MIT License
Mocha sets the value of the this
variable for the functions passed to describe
and test
/it
.
This allows to dynamically configure the behaviour of the tests (skip tests, define timeout, ...)
Their website mentions the following methods:
this.skip
this.retries
this.slow
this.timeout
I wasn't able to find a "structured" API documentation. There are more methods available when checking the source code, but supporting only the documented methods would be a good start.
The way how it
is defined as a callable ITestDefinition
interface makes it impossible for TS to infer the type of the done
callback.
declare var it: Mocha.ITestDefinition;
interface ITestDefinition {
(expectation: string, assertion?: () => void): ITest;
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
only(expectation: string, assertion?: () => void): ITest;
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
skip(expectation: string, assertion?: () => void): void;
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
timeout(ms: number): void;
}
Doing
it('whatever', done => {
});
yields
src/test/dbgp.ts(24,53): error TS7006: Parameter 'done' implicitly has an 'any' type.
This used to work. Now we have to do
it('whatever', (done: MochaDone) => {
});
Dear maintainers of the repository,
My name is Eyal and my team at JFrog is maintaining Frogbot, JFrog VS Code Extension and few more open source projects used by our community. We're using this great library in the JFrog VS Code Extension and wanted to thank you for creating this library.
We wanted to ask you whether you'd like us to install Frogbot on this repository for you. We can set it up to scan pull requests for security vulnerabilities and/or scan the entire repository periodically. The service is completely free of charge and we'll be helping and guiding you through the setup. We'll also be supporting you in case you'll need any future assistance.
Please let me know if you're interested. We can also continue communicating about this offline.
Thanks,
Eyal
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.