mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add types for baretest 1.0 (#43752)
* Add types for baretest 1.0 These files were based on the template written with `npx dts-gen --dt --name baretest --template module`. * Update baretest’s types for v2.0
This commit is contained in:
parent
75223873e6
commit
fe4a8005c5
37
types/baretest/baretest-tests.ts
Normal file
37
types/baretest/baretest-tests.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import baretest = require('baretest');
|
||||
|
||||
const test = baretest('my program');
|
||||
|
||||
function doSetup(): void {}
|
||||
function doCleanup(): void {}
|
||||
function assertSomeThings(): void {}
|
||||
|
||||
test.before(doSetup);
|
||||
|
||||
test.after(doCleanup);
|
||||
|
||||
test('it can do things', assertSomeThings);
|
||||
|
||||
test.skip('it can create world peace', assertSomeThings);
|
||||
|
||||
test('it can do things asynchronously', async () => {
|
||||
return;
|
||||
});
|
||||
|
||||
// $ExpectError
|
||||
test("you shouldn't return from a test function", () => {
|
||||
return 2 + 2;
|
||||
});
|
||||
|
||||
// $ExpectError
|
||||
test("you shouldn't take parameters in a test function", (people: number) => {});
|
||||
|
||||
// $ExpectError
|
||||
test("you shouldn't return from an async test function", async () => {
|
||||
return 'data from an API under test';
|
||||
});
|
||||
|
||||
(async () => {
|
||||
const result = await test.run();
|
||||
result; // $ExpectType boolean
|
||||
})();
|
||||
21
types/baretest/index.d.ts
vendored
Normal file
21
types/baretest/index.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Type definitions for baretest 2.0
|
||||
// Project: https://volument.com/baretest
|
||||
// Definitions by: Rory O’Kane <https://github.com/roryokane>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = baretest;
|
||||
|
||||
declare function baretest(headline: string): TesterFunctionObject;
|
||||
|
||||
type TesterFunctionObject = TesterFunction & TesterSubFunctions;
|
||||
|
||||
type TesterFunction = (name: string, fn: SyncOrAsyncVoidFunction) => void;
|
||||
interface TesterSubFunctions {
|
||||
only: (name: string, fn: SyncOrAsyncVoidFunction) => void;
|
||||
skip: (name?: string, fn?: SyncOrAsyncVoidFunction) => void;
|
||||
before: (fn: SyncOrAsyncVoidFunction) => void;
|
||||
after: (fn: SyncOrAsyncVoidFunction) => void;
|
||||
run: () => Promise<boolean>;
|
||||
}
|
||||
|
||||
type SyncOrAsyncVoidFunction = () => void | Promise<void>;
|
||||
24
types/baretest/tsconfig.json
Normal file
24
types/baretest/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"baretest-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/baretest/tslint.json
Normal file
1
types/baretest/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user