diff --git a/types/chai-snapshot-matcher/chai-snapshot-matcher-tests.ts b/types/chai-snapshot-matcher/chai-snapshot-matcher-tests.ts new file mode 100644 index 0000000000..254638df00 --- /dev/null +++ b/types/chai-snapshot-matcher/chai-snapshot-matcher-tests.ts @@ -0,0 +1,19 @@ +import chai = require('chai'); + +const { expect } = chai; +const context: Mocha.Context = {}; + +expect('foo').to.matchSnapshot(context); +expect('foo').to.matchSnapshot(context, 'hint'); + +expect('foo').to.matchSpecificSnapshot(context); +expect('foo').to.matchSpecificSnapshot(context, { hint: "(hint)" }); +expect('foo').to.matchSpecificSnapshot(context, { name: "snapshot with a specific name" }); +expect('foo').to.matchSpecificSnapshot(context, { folder: "Examples" }); +expect('foo').to.matchSpecificSnapshot(context, { snapshotPath: "/Users/my.user/Downloads/MySnapshots/" }); +expect('foo').to.matchSpecificSnapshot(context, { + hint: "(hint)", + name: "snapshot with a specific name", + folder: "Examples", + snapshotPath: "/Users/my.user/Downloads/MySnapshots/" +}); diff --git a/types/chai-snapshot-matcher/index.d.ts b/types/chai-snapshot-matcher/index.d.ts new file mode 100644 index 0000000000..17677e2f81 --- /dev/null +++ b/types/chai-snapshot-matcher/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for chai-snapshot-matcher 1.0 +// Project: https://github.com/tlameiras/chai-snapshot#readme +// Definitions by: tpluscode +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/// + +import { Context } from 'mocha'; + +declare global { + namespace Chai { + interface Assertion { + matchSnapshot(that: Context, hint?: string): void; + matchSpecificSnapshot(that: Context, options?: { + hint?: string; + name?: string; + folder?: string; + snapshotPath?: string; + }): void; + } + } +} + +export {}; diff --git a/types/chai-snapshot-matcher/tsconfig.json b/types/chai-snapshot-matcher/tsconfig.json new file mode 100644 index 0000000000..2262618471 --- /dev/null +++ b/types/chai-snapshot-matcher/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chai-snapshot-matcher-tests.ts" + ] +} diff --git a/types/chai-snapshot-matcher/tslint.json b/types/chai-snapshot-matcher/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chai-snapshot-matcher/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }