From f0bbb7e53e7b25d83fc9c53269a99f67bd5e49bd Mon Sep 17 00:00:00 2001 From: Alexander Smith Date: Wed, 19 Dec 2018 09:29:51 -0800 Subject: [PATCH] Added type definitions for 'tape-cup' package (v4.7.x) (#3015) --- .../flow_v0.74.x-/tape-cup_v4.7.x.js | 121 ++++++++++++++++++ .../flow_v0.74.x-/test_tape-cup_v4.7.x.js | 19 +++ 2 files changed, 140 insertions(+) create mode 100644 definitions/npm/tape-cup_v4.7.x/flow_v0.74.x-/tape-cup_v4.7.x.js create mode 100644 definitions/npm/tape-cup_v4.7.x/flow_v0.74.x-/test_tape-cup_v4.7.x.js diff --git a/definitions/npm/tape-cup_v4.7.x/flow_v0.74.x-/tape-cup_v4.7.x.js b/definitions/npm/tape-cup_v4.7.x/flow_v0.74.x-/tape-cup_v4.7.x.js new file mode 100644 index 0000000000..57ac5baa33 --- /dev/null +++ b/definitions/npm/tape-cup_v4.7.x/flow_v0.74.x-/tape-cup_v4.7.x.js @@ -0,0 +1,121 @@ +declare module 'tape-cup' { + declare type tape$TestOpts = + | { + skip: boolean, + timeout?: number, + } + | { + skip?: boolean, + timeout: number, + }; + + declare type tape$TestCb = (t: tape$Context) => mixed; + declare type tape$TestFn = ( + a: string | tape$TestOpts | tape$TestCb, + b?: tape$TestOpts | tape$TestCb, + c?: tape$TestCb + ) => void; + + declare interface tape$Context { + fail(msg?: string): void; + pass(msg?: string): void; + + error(err: mixed, msg?: string): void; + ifError(err: mixed, msg?: string): void; + ifErr(err: mixed, msg?: string): void; + iferror(err: mixed, msg?: string): void; + + ok(value: mixed, msg?: string): void; + true(value: mixed, msg?: string): void; + assert(value: mixed, msg?: string): void; + + notOk(value: mixed, msg?: string): void; + false(value: mixed, msg?: string): void; + notok(value: mixed, msg?: string): void; + + // equal + aliases + equal(actual: mixed, expected: mixed, msg?: string): void; + equals(actual: mixed, expected: mixed, msg?: string): void; + isEqual(actual: mixed, expected: mixed, msg?: string): void; + is(actual: mixed, expected: mixed, msg?: string): void; + strictEqual(actual: mixed, expected: mixed, msg?: string): void; + strictEquals(actual: mixed, expected: mixed, msg?: string): void; + + // notEqual + aliases + notEqual(actual: mixed, expected: mixed, msg?: string): void; + notEquals(actual: mixed, expected: mixed, msg?: string): void; + notStrictEqual(actual: mixed, expected: mixed, msg?: string): void; + notStrictEquals(actual: mixed, expected: mixed, msg?: string): void; + isNotEqual(actual: mixed, expected: mixed, msg?: string): void; + isNot(actual: mixed, expected: mixed, msg?: string): void; + not(actual: mixed, expected: mixed, msg?: string): void; + doesNotEqual(actual: mixed, expected: mixed, msg?: string): void; + isInequal(actual: mixed, expected: mixed, msg?: string): void; + + // deepEqual + aliases + deepEqual(actual: mixed, expected: mixed, msg?: string): void; + deepEquals(actual: mixed, expected: mixed, msg?: string): void; + isEquivalent(actual: mixed, expected: mixed, msg?: string): void; + same(actual: mixed, expected: mixed, msg?: string): void; + + // notDeepEqual + notDeepEqual(actual: mixed, expected: mixed, msg?: string): void; + notEquivalent(actual: mixed, expected: mixed, msg?: string): void; + notDeeply(actual: mixed, expected: mixed, msg?: string): void; + notSame(actual: mixed, expected: mixed, msg?: string): void; + isNotDeepEqual(actual: mixed, expected: mixed, msg?: string): void; + isNotDeeply(actual: mixed, expected: mixed, msg?: string): void; + isNotEquivalent(actual: mixed, expected: mixed, msg?: string): void; + isInequivalent(actual: mixed, expected: mixed, msg?: string): void; + + // deepLooseEqual + deepLooseEqual(actual: mixed, expected: mixed, msg?: string): void; + looseEqual(actual: mixed, expected: mixed, msg?: string): void; + looseEquals(actual: mixed, expected: mixed, msg?: string): void; + + // notDeepLooseEqual + notDeepLooseEqual(actual: mixed, expected: mixed, msg?: string): void; + notLooseEqual(actual: mixed, expected: mixed, msg?: string): void; + notLooseEquals(actual: mixed, expected: mixed, msg?: string): void; + + throws(fn: Function, expected?: RegExp | Function, msg?: string): void; + throws(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, expected?: RegExp | Function, msg?: string): void; + doesNotThrow(fn: Function, msg?: string): void; + + timeoutAfter(ms: number): void; + + skip(msg?: string): void; + plan(n: number): void; + onFinish(fn: Function): void; + end(): void; + comment(msg: string): void; + test: tape$TestFn; + } + + declare type TestHarness = Tape; + declare type StreamOpts = { + objectMode?: boolean, + }; + + declare type Tape = { + ( + a: string | tape$TestOpts | tape$TestCb, + b?: tape$TestCb | tape$TestOpts, + c?: tape$TestCb, + ...rest: Array + ): void, + test: tape$TestFn, + skip: (name: string, cb?: tape$TestCb) => void, + createHarness: () => TestHarness, + createStream: (opts?: StreamOpts) => stream$Readable, + only: ( + a: string | tape$TestOpts | tape$TestCb, + b?: tape$TestCb | tape$TestOpts, + c?: tape$TestCb, + ...rest: Array + ) => void, + }; + + declare module.exports: Tape; +} diff --git a/definitions/npm/tape-cup_v4.7.x/flow_v0.74.x-/test_tape-cup_v4.7.x.js b/definitions/npm/tape-cup_v4.7.x/flow_v0.74.x-/test_tape-cup_v4.7.x.js new file mode 100644 index 0000000000..810ed8f63d --- /dev/null +++ b/definitions/npm/tape-cup_v4.7.x/flow_v0.74.x-/test_tape-cup_v4.7.x.js @@ -0,0 +1,19 @@ +// @flow + +import test from 'tape-cup'; + +test('some sanity test', t => { + t.fail(); + t.fail('some message'); + + t.ok(5, 'some value provided'); + t.ok(5); // without optional message + + t.equal('hello', 'goodbye', 'some message'); + + // $ExpectError + t.plan(); + t.plan(5); +}); + +test.only('single sanity test', t => {});