diff --git a/types/bintrees/bintrees-tests.ts b/types/bintrees/bintrees-tests.ts index fb4a22a3d8..84b75c98be 100644 --- a/types/bintrees/bintrees-tests.ts +++ b/types/bintrees/bintrees-tests.ts @@ -1,8 +1,11 @@ -/// /// import assert = require('assert'); import { BinTree, RBTree } from 'bintrees'; +// Declaring shims removes mocha dependency. These tests are never executed, only typechecked, so this is fine. +declare function describe(description: string, callback: () => void): void; +declare function it(description: string, callback: () => void): void; + describe('bintrees', () => { it('builds a simple tree', () => { let treeA = new RBTree((a: number, b: number) => a - b); diff --git a/types/chai-jest-snapshot/index.d.ts b/types/chai-jest-snapshot/index.d.ts index 862da8cd16..470e4fa423 100644 --- a/types/chai-jest-snapshot/index.d.ts +++ b/types/chai-jest-snapshot/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/suchipi/chai-jest-snapshot#readme // Definitions by: Matt Perry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/types/chai-spies/chai-spies-tests.ts b/types/chai-spies/chai-spies-tests.ts index 326b1e0137..1d99f0add2 100644 --- a/types/chai-spies/chai-spies-tests.ts +++ b/types/chai-spies/chai-spies-tests.ts @@ -1,6 +1,5 @@ import * as chai from 'chai'; import * as spies from 'chai-spies'; -import * as Mocha from 'mocha'; function original(): void { // do something cool diff --git a/types/chai-string/chai-string-tests.ts b/types/chai-string/chai-string-tests.ts index dc798c102a..9cd9a2e024 100644 --- a/types/chai-string/chai-string-tests.ts +++ b/types/chai-string/chai-string-tests.ts @@ -1,6 +1,4 @@ -/// - var should = chai.should(); var assert = chai.assert; var expect = chai.expect; @@ -8,6 +6,11 @@ var expect = chai.expect; import chai_string = require("chai-string"); chai.use(chai_string); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('chai-string', function() { describe('#startsWith', function() { diff --git a/types/create-error/create-error-tests.ts b/types/create-error/create-error-tests.ts index 7a635b8dc6..ed2d9533e3 100644 --- a/types/create-error/create-error-tests.ts +++ b/types/create-error/create-error-tests.ts @@ -1,8 +1,12 @@ -/// declare function equal(a: T, b: T): void; declare function deepEqual(a: T, b: T): void; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + import * as createError from 'create-error'; // Example taken from https://github.com/tgriesser/create-error/blob/0.3.1/README.md#use diff --git a/types/d3kit/v1/d3kit-tests.ts b/types/d3kit/v1/d3kit-tests.ts index 9ffb7ca2ba..18f1f144f9 100644 --- a/types/d3kit/v1/d3kit-tests.ts +++ b/types/d3kit/v1/d3kit-tests.ts @@ -1,6 +1,10 @@ -/// /// +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + var expect = chai.expect; describe('Skeleton', function(){ var element: Element, $element: d3.Selection, $svg: d3.Selection, skeleton: d3kit.Skeleton; diff --git a/types/expect/expect-tests.ts b/types/expect/expect-tests.ts index fea4a3d4d9..5df83340cb 100644 --- a/types/expect/expect-tests.ts +++ b/types/expect/expect-tests.ts @@ -1,8 +1,11 @@ -/// - import { Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies } from 'expect'; import * as expect from 'expect'; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('chaining assertions', () => { it('should allow chaining for array-like applications', () => { expect([ 1, 2, 'foo', 3 ]) diff --git a/types/expectations/expectations-tests.ts b/types/expectations/expectations-tests.ts index b0cef0aa0f..4e994e7546 100644 --- a/types/expectations/expectations-tests.ts +++ b/types/expectations/expectations-tests.ts @@ -1,9 +1,12 @@ -/// - // transplant from https://github.com/spmason/expectations/blob/695c25bd35bb1751533a8082a5aa378e3e1b381f/test/expect.tests.js var root = this; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('expect', ()=> { describe('toEqual', ()=> { it('can expect true to be true', ()=> { diff --git a/types/fbemitter/fbemitter-tests.ts b/types/fbemitter/fbemitter-tests.ts index 1a4983242f..22424fc442 100644 --- a/types/fbemitter/fbemitter-tests.ts +++ b/types/fbemitter/fbemitter-tests.ts @@ -1,5 +1,4 @@ /// -/// 'use strict'; @@ -11,6 +10,11 @@ import { EventEmitter, EventSubscription } from 'fbemitter'; import * as util from 'util'; import * as assert from 'assert'; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('EventEmitter', function tests() { 'use strict'; diff --git a/types/gulp-mocha/index.d.ts b/types/gulp-mocha/index.d.ts index ae56e9a9ac..ba1a6d4fca 100644 --- a/types/gulp-mocha/index.d.ts +++ b/types/gulp-mocha/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/sindresorhus/gulp-mocha // Definitions by: Asana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/types/gulp-util/gulp-util-tests.ts b/types/gulp-util/gulp-util-tests.ts index 47e705bf00..1781ce7664 100644 --- a/types/gulp-util/gulp-util-tests.ts +++ b/types/gulp-util/gulp-util-tests.ts @@ -1,5 +1,3 @@ -/// - import gulp = require('gulp'); import util = require('gulp-util'); import path = require('path'); @@ -7,6 +5,11 @@ import Stream = require('stream'); import through = require('through2'); const es = require('event-stream'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + // TODO: These aren't useful as types tests since they take `any`. declare const should: ShouldStatic; interface ShouldStatic { diff --git a/types/hexo-fs/hexo-fs-tests.ts b/types/hexo-fs/hexo-fs-tests.ts index 5f73cd91fc..7bd5dc13b8 100644 --- a/types/hexo-fs/hexo-fs-tests.ts +++ b/types/hexo-fs/hexo-fs-tests.ts @@ -1,9 +1,13 @@ import fs = require('hexo-fs'); import { join, dirname } from 'path'; -import 'mocha'; import chai = require('chai'); import Promise = require('bluebird'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + const should = chai.should(); function createDummyFolder(path: string) { @@ -198,7 +202,8 @@ it('copyFile() - callback', callback => { if (err) return callback(err); fs.readFile(dest, (err, content) => { - if (err) return callback(err); + if (err) + return callback(err); content!.should.eql(body); Promise.all([ diff --git a/types/incremental-dom/incremental-dom-tests.ts b/types/incremental-dom/incremental-dom-tests.ts index 2e30297e57..f593299575 100644 --- a/types/incremental-dom/incremental-dom-tests.ts +++ b/types/incremental-dom/incremental-dom-tests.ts @@ -1,6 +1,10 @@ -/// declare var expect: any; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + import id = require('incremental-dom'); var patch = id.patch; var elementVoid = id.elementVoid; diff --git a/types/libpq/libpq-tests.ts b/types/libpq/libpq-tests.ts index f1ae6cc1e3..7d19e910cd 100644 --- a/types/libpq/libpq-tests.ts +++ b/types/libpq/libpq-tests.ts @@ -1,10 +1,13 @@ -/// - import { Buffer } from 'buffer'; import assert = require('assert'); import * as async from 'async'; import PQ = require('libpq'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + declare const _: { times(n: number, f: () => T): T[] }; declare const ok: Function; diff --git a/types/mocha-steps/index.d.ts b/types/mocha-steps/index.d.ts index 0234f02529..8bd32496aa 100644 --- a/types/mocha-steps/index.d.ts +++ b/types/mocha-steps/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/rprieto/mocha-steps // Definitions by: AryloYeung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/types/mz/mz-tests.ts b/types/mz/mz-tests.ts index 7eda9f28bf..b873c98bbe 100644 --- a/types/mz/mz-tests.ts +++ b/types/mz/mz-tests.ts @@ -1,8 +1,11 @@ -/// - import assert = require('assert') import fs = require('mz/fs') +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe('fs', function () { it('.stat()', function (done) { diff --git a/types/project-oxford/project-oxford-tests.ts b/types/project-oxford/project-oxford-tests.ts index ea2849d986..b4a76a78c4 100644 --- a/types/project-oxford/project-oxford-tests.ts +++ b/types/project-oxford/project-oxford-tests.ts @@ -1,11 +1,14 @@ -/// - import oxford = require("project-oxford"); import assert = require('assert'); import _Promise = require('bluebird'); import fs = require('fs'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + var client = new oxford.Client(process.env.OXFORD_KEY); // Store variables, no point in calling the api too often diff --git a/types/quixote/quixote-tests.ts b/types/quixote/quixote-tests.ts index 5ee9905ac0..381ee5f5fd 100644 --- a/types/quixote/quixote-tests.ts +++ b/types/quixote/quixote-tests.ts @@ -1,5 +1,7 @@ -/// - +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; function test_createFrame() { var frame: QFrame; diff --git a/types/vinyl-fs/vinyl-fs-tests.ts b/types/vinyl-fs/vinyl-fs-tests.ts index 9aa9a02513..6cecf42f47 100644 --- a/types/vinyl-fs/vinyl-fs-tests.ts +++ b/types/vinyl-fs/vinyl-fs-tests.ts @@ -13,7 +13,10 @@ import File = require('vinyl'); // const spies = require('./spy'); declare const spies: any; -import 'mocha'; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; // TODO: These aren't useful as types tests since they take `any`. declare const should: ShouldStatic; diff --git a/types/vinyl/v0/vinyl-tests.ts b/types/vinyl/v0/vinyl-tests.ts index 27ea92a283..8c7de1ea52 100644 --- a/types/vinyl/v0/vinyl-tests.ts +++ b/types/vinyl/v0/vinyl-tests.ts @@ -1,9 +1,12 @@ -/// - import File = require('vinyl'); import Stream = require('stream'); import fs = require('fs'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + declare var fakeStream: NodeJS.ReadWriteStream; // TODO: These aren't useful as types tests since they take `any`. diff --git a/types/vinyl/vinyl-tests.ts b/types/vinyl/vinyl-tests.ts index 77ef5d6d1b..bd059b0427 100644 --- a/types/vinyl/vinyl-tests.ts +++ b/types/vinyl/vinyl-tests.ts @@ -1,5 +1,3 @@ -/// - import * as fs from 'fs'; import * as path from 'path'; import expect = require('expect'); @@ -8,6 +6,11 @@ const cloneable = require('cloneable-readable'); import File = require('vinyl'); +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + /** * Custom and private properties needed for tests. * diff --git a/types/webdriverio/webdriverio-tests.ts b/types/webdriverio/webdriverio-tests.ts index 4a078ef6e9..56dc3ddfda 100644 --- a/types/webdriverio/webdriverio-tests.ts +++ b/types/webdriverio/webdriverio-tests.ts @@ -1,8 +1,11 @@ -/// - import * as webdriverio from "webdriverio"; import { assert } from "chai"; +// Stub mocha functions +const {describe, it, before, after, beforeEach, afterEach} = null as any as { + [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any}; +}; + describe("webdriver.io page", () => { it("should have the right title - the good old callback way", () => { assert.equal(