Git Product home page Git Product logo

mocha's People

Contributors

bpasero avatar eseliger avatar greenkeeper[bot] avatar ibratoev avatar unional avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mocha's Issues

Type context of spec and assertion functions

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.

Type for done not inferred

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) => {

});

Using Frogbot to scan this repository

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.