0.0.35 • Published 6 months ago

@types/nodeunit v0.0.35

Weekly downloads
4,126
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/nodeunit

Summary

This package contains type definitions for nodeunit (https://github.com/caolan/nodeunit).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodeunit.

index.d.ts

// Type definitions for nodeunit
// Project: https://github.com/caolan/nodeunit
// Definitions by: Jeff Goddard <https://github.com/jedigo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

// Imported from: https://github.com/soywiz/typescript-node-definitions/nodeunit.d.ts


export interface ITestCase {
    (testCase: { [property: string]: ITestBody | ITestGroup | void }): void;
}
export declare var testCase: ITestCase;

export interface Test {
    done: ICallbackFunction;
    expect(num: number): void;

    //assersions from node assert module
    fail(actual: any, expected: any, message: string, operator: string): void;
    assert(value: any, message: string): void;
    ok(value: any, message?: string): void;
    equal(actual: any, expected: any, message?: string): void;
    notEqual(actual: any, expected: any, message?: string): void;
    deepEqual(actual: any, expected: any, message?: string): void;
    notDeepEqual(actual: any, expected: any, message?: string): void;
    strictEqual(actual: any, expected: any, message?: string): void;
    notStrictEqual(actual: any, expected: any, message?: string): void;
    throws(block: any, error?: any, message?: string): void;
    doesNotThrow(block: any, error?: any, message?: string): void;
    ifError(value: any): void;

    //assertion wrappers
    equals(actual: any, expected: any, message?: string): void;
    same(actual: any, expected: any, message?: string): void;
}

// Test Group Usage:
//  var testGroup: nodeunit.ITestGroup = {
//      setUp: (callback) => {
//           callback();
//      },
//      tearDown: (callback) => {
//            callback();
//      },
//      test1: (test: nodeunit.Test) => {
//          test.done();
//      }
//    }
//    exports.testgroup = testGroup;

export interface ITestBody {
    (callback: Test): void;
}

export interface ITestGroup {
    /** The setUp function is run before each test */
    setUp?: ((callback: ICallbackFunction) => void) | undefined;
    /** The tearDown function is run after each test calls test.done() */
    tearDown?: ((callback: ICallbackFunction) => void) | undefined;
    [property: string]: ITestGroup | ITestBody | ((callback: ICallbackFunction) => void) | undefined;
}

export interface ICallbackFunction {
    (err?: any): void;
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 18:51:36 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Jeff Goddard.

0.0.33

8 months ago

0.0.34

7 months ago

0.0.35

6 months ago

0.0.32

3 years ago

0.0.31

4 years ago

0.0.30

8 years ago

0.0.29

8 years ago

0.0.28

8 years ago

0.0.27-alpha

8 years ago

0.0.26-alpha

8 years ago

0.0.25-alpha

8 years ago

0.0.24-alpha

8 years ago

0.0.23-alpha

8 years ago

0.0.22-alpha

8 years ago

0.0.21-alpha

8 years ago

0.0.16-alpha

8 years ago

0.0.15-alpha

8 years ago